I am making a chatting application in android. I am able to perform the live chatting. But i am not able to get when the user is online or offline. How can I achieve the same
Thanks
here is the code
private void getListener() {
Roster roster = connection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
for (RosterEntry rosterEntry : entries) {
String user = rosterEntry.getUser();
Presence presence = roster.getPresence(user);
System.out.println("User : " + user);
System.out.println("Presence : " + presence); // 1
System.out.println("Presence type: " + presence.getType()); // 2
System.out.println("Presence mode: " + presence.getMode());
}
}
but i always get the status unavailable, also when the person is available. Please tell me any solution what to do?? Thanks