powered by Jive Software

roster.getEntries always return empty

Hi guys!!

Sorry my english, i need study more…

I need help, because i want to get all users online… but is always return empty… And i don’t know what i do. =/

if (connection != null && !connection.isConnected()) {

connection.connect();

connection.addConnectionListener(this);

connection.addPacketListener(this, new MessageTypeFilter(Message.Type.chat));

if (!connection.isAuthenticated()) {

String id = String.valueOf(SdmApplication.getUser().getId());

connection.login(id, “1”);

}

Roster roster = connection.getRoster();

try {

Thread.sleep(10000);

} catch (InterruptedException e) {

e.printStackTrace();

}

Collection entries = roster.getEntries();

for (RosterEntry rosterEntry : entries) {

String user = rosterEntry.getUser();

Presence presence = roster.getPresence(user);

System.out.println("Presence: " + presence);

System.out.println("Presence type: " + presence.getType());

System.out.println("Presence mode: " + presence.getMode());

}