问题
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