-2

i have integrated quickblox android SDk in my app and there are more than 500 dialogs group in list and when i try to join any group chat room, I am not getting entered in either of onSuccess() and onError() ,control flow just goes bypassing callback methods by using below code.

    qbChatDialog.initForChat(QBChatService.getInstance());
    qbChatDialog.addMessageListener(chatMessageListener);

    DiscussionHistory discussionHistory = new DiscussionHistory();
    discussionHistory.setMaxStanzas(0);

    if (!qbChatDialog.isJoined()) {
        qbChatDialog.join(discussionHistory, new QBEntityCallback() {
            @Override
            public void onSuccess(Object o, Bundle bundle) {
                if (qbChatDialog != null) {
                    getMessage(qbChatDialog, false);
                }
            }

            @Override
            public void onError(QBResponseException e) {
                Log.e("QB Join", e.toString());
                Toast.makeText(QBChatActivity.this, "" + e.toString(), Toast.LENGTH_LONG).show();

            }
        });
    } else {
        if (qbChatDialog != null) {
            getMessage(qbChatDialog, false);
        }
    }
Nirav Bhavsar
  • 2,133
  • 2
  • 20
  • 24

1 Answers1

0

I think the problem is Group type .
if you want to create a public group which anyone can join then you should create with QBDialogType.PUBLIC_GROUP.

In case of QBDialogType.GROUP participants should be add at the time of creation and only those participants can join the group which were added .

Solution is create your dialog with type QBDialogType.PUBLIC_GROUP if you want it to public .

QBChatDialog qbChatDialog=new QBChatDialog();
qbChatDialog.setType(QBDialogType.PUBLIC_GROUP);// For public group
qbChatDialog.setType(QBDialogType.GROUP);// For private group
ADM
  • 20,406
  • 11
  • 52
  • 83
  • Did you add the current user to group at the time of creation? or add as participant later by creator ? Try to debug getOccupants() on dialog and see if your id is in list or not . – ADM Dec 27 '17 at 10:55
  • add user during creation, let me clear you i have around more than 500 dialog group list and when i try to join in any group then callback never calls, and it when into endless loading. and yes im in the occupant list – Nirav Bhavsar Dec 27 '17 at 11:01
  • Ok this seems weird. First make sure you are part of dialog by debugging getOccupants() on dialog . Second instead of using SDk method use Rest API just for debugging purpose . Also check the XMPP **logs** during calling Join . – ADM Dec 27 '17 at 11:03
  • ok i found that, in my project 'auto_join' was 'true', and as i have more than 500 dialogs groups, so when i retrieve all groups dialog it takes lots of time for numerous synchronous join attempts in background hence it was not working in my case, so after i have set 'auto_join' as 'false' and then when i try to join any single group dialog, it was successfull., thanks for your effort – Nirav Bhavsar Dec 27 '17 at 11:36
  • I too had configurationBuilder.setAutojoinEnabled(true);` but i don't faced the same problem . Why ? – ADM Dec 27 '17 at 11:47