I am trying to implement android chat application by using XMPP(aSmack).I check my code are correct are okay for login ,registration.Now i am trying to get all user information (offline/online/away/etc.) I try to used by Presence.But i can't success.When the xmpp connection are okay and user login success then i call the Presence by
if (connection != null && connection.isConnected()) {
Presence presence = new Presence(Presence.Type.available);
presence.setStatus("I’m available");
connection.sendPacket(presence);
Log.w("type", "I’m available");
}
After calling this function then i try to get all user information .My Roster code are:
Roster roster = connection.getRoster();
// Get all rosters
Collection<RosterEntry> entries = roster.getEntries();
Log.w("Size ", "are"+entries.size());
// loop through
for (RosterEntry entry : entries) {
// example: get presence, type, mode, status
Presence entryPresence = roster.getPresence(entry.getUser());
Presence.Type userType = entryPresence.getType();
Presence.Mode mode = entryPresence.getMode();
String status = entryPresence.getStatus();
Log.w("mode ", "are"+mode);
Log.w("status ", "are"+status);
Log.w("mode ", "are"+entryPresence.isAvailable());
}
But my problem,All the time i get one entries size,who i am.without my mode show all the time false(That means i am unavailable).I don't understand what it the problem.I need work on server config. again.or My code are wrong.Please help to me how i can solve those two issues.Thanks all.