从1.2.4升级到2.0版时,我遇到QuickBlox问题。
在2.0版中如何检测用户加入或离开群聊对话框?
在版本1.2.4中,我使用ParticipantListener但版本2.2 QBGroupChat无法添加此侦听器?
提前感谢。
版本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
}
}
};
答案 0 :(得分:2)
以下是如何将QBParticipantListener用于版本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