QuickBlox 2.0 Chat dialog - how to detect an user join or leave group chat dialog?

做~自己de王妃 提交于 2019-12-11 03:15:25

问题


I have trouble with QuickBlox when update from version 1.2.4 to version 2.0.

In version 2.0 how to detect a user join or leave group chat dialog?

In version 1.2.4 i use ParticipantListener but version 2.2 QBGroupChat cant not add this listener ?

Thank in advance.

Version 1.2.4:

PacketListener participantListener = new PacketListener() {

    @Override
    public void processPacket(Packet packet) {
        Presence presence = (Presence) packet;

        if (presence.getType() == Presence.Type.available) {
            // user entered the room

        } else if (presence.getType() == Presence.Type.unavailable) {
            // user left the room

        }

    }
};

回答1:


Here is how to use QBParticipantListener for version 2.1:

private QBParticipantListener participantListener;

participantListener = new QBParticipantListener() {
    @Override
    public void processPresence(QBGroupChat groupChat, QBPresence presence) {

    }
};

private QBGroupChat currentChatRoom = ...;
currentChatRoom.addParticipantListener(participantListener);

http://quickblox.com/developers/Android_XMPP_Chat_Sample#Get_online_users



来源:https://stackoverflow.com/questions/27419282/quickblox-2-0-chat-dialog-how-to-detect-an-user-join-or-leave-group-chat-dialo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!