Quick Blox SDK Presence未在首次登录时在线收到

时间:2016-09-30 11:16:26

标签: android quickblox

我正在使用quick blox sdk聊天和显示在线用户并更新他们的在线/离线状态。一切正常,但在第一次登录时,根据以下日志收到5xxxx7 QBId,

D/SMACK: RECV (1): <presence xmlns="jabber:client" from="5388507-28074@chat.quickblox.com/android_00000000-57d0-4ecf-ffff-ffffef05ac4a" to="16269676-28074@chat.quickblox.com" id="bQzT2-9587"/>

09-30 16:38:19.944 20513-21578/com.FCK.provider D/NativeCrypto: ssl=0xd86e0d40 sslRead buf=0xd403af98 len=104,timeo=60000

但在我面前,听众没有记录任何内容:

 rosterListener = new QBRosterListener() {
            @Override
            public void entriesDeleted(Collection<Integer> userIds) {
                log("entriesDeleted: " + userIds);
            }

            @Override
            public void entriesAdded(Collection<Integer> userIds) {
                log("entriesAdded: " + userIds);
            }

            @Override
            public void entriesUpdated(Collection<Integer> userIds) {
                log("entriesUpdated: " + userIds);
            }

            @Override
            public void presenceChanged(QBPresence presence) {
                log("presenceChanged: " + presence);
                EventBus.getDefault().post(presence);
                if(chatServiceListener != null){
                    chatServiceListener.presenceChanged(presence);
                }
//                {type=online, user=5507990, status=null}
            }
        };

即使我通过以下代码手动访问,即使他在线并且我可以与他聊天,我也会让用户离线:

QBPresence presence = сhatRoster.getPresence(userID);
        if (presence == null) {
            log("No user in your roster");
            return;
        }
        if (presence.getType() == QBPresence.Type.online) {
            log("User " + userID + " is online");
        } else {
            log("User " + userID + " is offline");
        }

1 个答案:

答案 0 :(得分:0)

更新了以下代码在gradle文件中使用的Quick Blox SDK,它已解决:

dependencies {
   compile("com.quickblox:quickblox-android-sdk-chat:2.6.1")
}