Search code examples
androidquickblox

nothing happens when creating dialog at quickblox android


I want to connect to a group chat with quickblox. following the samples I made this snippet:

Log.e(TAG, "Logged into chat service successfully, creating dialog...");
if (Looper.myLooper() == null) {
    Looper.prepare();
}
QBDialog dialogToCreate = new QBDialog();
dialogToCreate.setName("Test");
dialogToCreate.setType(QBDialogType.GROUP);
ArrayList<Integer> a = new ArrayList<Integer>();
a.add(qbUser.getId());
dialogToCreate.setOccupantsIds(a);
QBChatService.getInstance().getGroupChatManager().createDialog(dialogToCreate, new QBEntityCallbackImpl<QBDialog>() {
    @Override
     public void onSuccess(QBDialog dialog, Bundle args) {
        Log.e(TAG, "Dialog created");
        ConversationActivity.this.dialog = dialog;
        initViews();
    }

    @Override
    public void onSuccess() {
        Log.e(TAG, "onSuccess without data");
    }

    @Override
    public void onError(List<String> errors) {
        Log.e(TAG, "Error creating dialog: "+ errors.toString());
    }
});

but the callback in createDialog is never triggered. No error is received. What may I be doing wrong?

Thanks in advance.


Solution

  • Got it! I was creating session with wrong method. Now I'm using QBAuth.createSession(QBUser, QBEntityCallbackImpl) if user has already logged in, and QBAuth.createSession(QBEntityCallbackImpl) followed by QBUsers.signUp() if not.

    Not sure where is this on docs/samples, though...