tech.mohit.garg
tech.mohit.garg

Reputation: 680

how to create chat session in quickblox using Email and password

i am using quickblox chat api for group chat.I am creating chat session using username and password . this is my code to creatr session for chat.

final QBUser user = new QBUser();
        user.setLogin(username);
        user.setPassword(password);

        QBAuth.createSession(user, new QBEntityCallbackImpl<QBSession>() {
            @Override
            public void onSuccess(QBSession session, Bundle args) {

                System.out.println("user  id " + session.getUserId());

                user.setId(session.getUserId());
                ((ApplicationSingleton) getParent().getApplication()
                        .getApplicationContext()).setCurrentUser(user);

                loginToChat(user);

            }

            @Override
            public void onError(List<String> errors) {

                editor.putBoolean("ISCHECKED", false);
                editor.putString("Username", "");
                editor.putString("Password", "");
                editor.commit();

                AlertDialog.Builder dialog = new AlertDialog.Builder(
                        getParent());
                dialog.setMessage("create session errors: " + errors).create()
                        .show();
                pDialog.dismiss();
            }
        });

but i want to create session using email and password. Anybody have any idea to do this.

Upvotes: 0

Views: 1151

Answers (1)

Rubycon
Rubycon

Reputation: 18346

The same, but set an email instead of login

final QBUser user = new QBUser();
user.setEmail(email);
user.setPassword(password);

Upvotes: 1

Related Questions