Ravi Vaghela
Ravi Vaghela

Reputation: 3420

Android: How to get online or offline user status in quickblox?

I am not able to get user offline and online status in quickblox. In simple chat demo of quickblox. I am using This demo for chatting. But that in i can't get user online offline status. and I have already search and refer many links but not get success. Thanks Advance.

Reffed links:

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

Upvotes: 1

Views: 1067

Answers (1)

Pranav Darji
Pranav Darji

Reputation: 752

Use below code will help you.

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());
}

Upvotes: 0

Related Questions