【问题标题】:Android: How to get online or offline user status in quickblox?Android:如何在 quickblox 中获取在线或离线用户状态?
【发布时间】:2017-05-25 20:38:15
【问题描述】:

我无法在 quickblox 中获取用户的离线和在线状态。在 quickblox 的简单聊天演示中。我正在使用This 演示进行聊天。但是在我无法获得用户在线离线状态。我已经搜索并引用了许多链接,但没有成功。谢谢提前。

引用链接:

https://github.com/QuickBlox/quickblox-android-sdk/tree/master/sample-chat https://github.com/QuickBlox/quickblox-android-sdk http://quickblox.com/developers/SimpleSample-users-android https://assist.quickblox.com/index.php?/Knowledgebase/Article/View/35/0/how-to-find-out-whether-quickblox-user-is-online https://quickblox.com/developers/Android_XMPP_Chat_Sample#Guide:_Getting_Started_with_Chat_API

【问题讨论】:

  • 你尝试过哪些“很多链接”的代码?
  • 先生检查更新的问题。和我没有的代码
  • @cricket_007 在我登录时可以获得状态,但是当我的应用程序在后台时,我无法管理这个。
  • @Ravi Vaghela 你有什么解决办法吗?如果是,请在这里分享。

标签: java android chat quickblox


【解决方案1】:

使用下面的代码会对你有所帮助。

Roster roster = xmppConnection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
Presence presence;

for(RosterEntry entry : entries) {
    presence = roster.getPresence(entry.getUser());

    System.out.println(entry.getUser());
    System.out.println(presence.getType().name());
    System.out.println(presence.getStatus());
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-05
    • 2017-02-12
    相关资源
    最近更新 更多