use of com.applozic.mobicomkit.api.account.user.UserLoginTask.TaskListener in project Applozic-Android-SDK by AppLozic.
the class ApplozicBridge method startChatActivity.
/**
* Starts the chat activity if user is not loggedIn then it will login to applozic server and launch the chat-list
* else if user is loggedIn then directly opens chat-list
*
* @param context
* @param user :User object
*/
private static void startChatActivity(Context context, User user) {
if (!MobiComUserPreference.getInstance(context).isLoggedIn()) {
TaskListener listener = new TaskListener() {
@Override
public void onSuccess(RegistrationResponse registrationResponse, Context context) {
// Todo: get pushnotification id.
String pushNotificationId = "";
gcmRegister(context, pushNotificationId);
launchChat(context);
}
@Override
public void onFailure(RegistrationResponse registrationResponse, Exception exception) {
}
};
user = user != null ? user : getLoggedInUserInformation();
new UserLoginTask(user, listener, context).execute((Void) null);
} else {
launchChat(context);
}
}
Aggregations