Check whether dialog is present between the two users or not in android-Quickblox

227 Views Asked by At

I am building an Android Application integrated with Quickblox. I am using the quickblox for chats only. I want to know how to check whether the dialogs between the users is present or not. The problem I am facing whenever I click the button new dialog is created and Quickblox is not able to fetch the chats. The main task to check to create the chat activity after clicking the button.

1

There are 1 best solutions below

1
Harminder Singh On

Just use the dialog list data to achive this:

public QBChatDialog getPrivateDialogWithUserId(int id) {
    for (QBChatDialog chatDialog : dialogsMap.values()) {
        if (QBDialogType.PRIVATE.equals(chatDialog.getType())
                && chatDialog.getOccupants().contains(id)) {
            return chatDialog;
        }
    }

    return null;
}