简体   繁体   中英

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

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.

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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM