Question

I have an asmack based client, I connect and authenticate, then I fetch a roster, to which I attach a listener and I set myself available.

The listener correctly picks up any changes to presence made after I connect, however I can't find a way of getting the current state of all the entries on my roster.

I tried sending a Presence.Type.subscribe packet, I tried using Roster#reload() and I've tried the following:

for (RosterEntry entry : mRoster.getEntries()) {
   Presence presence = mRoster.getPresence( entry.getUser() );
   ...
}

(If I log the presence object above, they all show as 'unavailable')

I've also tried mRoster.getPresence(handle) inside entriesUpdated when I get the callback from Roster#reload and separately when looping over Roster#getEntries, I get valid user id's but the presence mode is null and type is unavailable for every entry

Is there a way I can prompt the server to send me the current remote information?

Was it helpful?

Solution 2

I have solved this issue, it appears part of the example I followed to set up my configuration was incorrect.

Including the following setting in your ConnectionConfiguration will cause the issue:

config.setSendPresence(false);

After I removed this, initial presences were updated correctly

OTHER TIPS

What about

Roster.getEntries()

?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top