This thread is archived
5 Replies Last post: Apr 19, 2007 8:34 AM by Brad Mace  
darkfrog   3 posts since
Apr 18, 2007
Currently Being Moderated

Apr 18, 2007 2:48 PM

Presence Information

I understand that the Presence information is asynchronous, which explains why roster.getPresence return unavailable for nearly every user.  However, I only receive presence changes (from my RosterListener)  for a very small number of my contacts on my contact list.  I''ve figured out how to connect and process the Roster, but I can''t seem to figure out how to reliably get the Presence information.  Essentially all I''m trying to do is duplicate the functionality of Spark where you connect and it displays a list of your users and their Presence information.

 

I assumed that presenceChanged would be invoked for every online user as it receives information for each user, but it seems that is not so...

 

Help very appreciated.

Brad Mace Bronze 124 posts since
Sep 16, 2005
Currently Being Moderated
Apr 18, 2007 3:04 PM in response to: darkfrog
Re: Presence Information

I was having some problems with message delivery notifications that sound similar to what you described.  Adding the following caused all events to work (for reasons unknown).  It''s worth a shot.

 

xmpp.addPacketListener(new PacketListener() { public void processPacket(Packet p) {} }, new PacketFilter() { public boolean accept(Packet p) { return false;} });

 

 

 

 

 

Brad Mace Bronze 124 posts since
Sep 16, 2005
Currently Being Moderated
Apr 19, 2007 8:34 AM in response to: darkfrog
Re: Presence Information

I think Chris was on the right track.  You might be trying to read presence info before you''re finished logging in.  Also,  it may not call presenceChanged for each entry when you log in.  Maybe you need to read their initial presences with Roster.getPresence, and then watch for subsequent changes using the RosterListener.

Chris Ward Silver 89 posts since
Aug 16, 2005
Currently Being Moderated
Apr 18, 2007 3:56 PM in response to: darkfrog
Re: Presence Information

I have been able to get presenceChanged events for all users in my roster using Smack 3.0.0.  I attach the RosterListener after the login method completes and it seems to work fine.  Maybe you could provide more information on your environment/setup?  One thought, are you properly subscribed to all the users you are trying to get presence information for?

More Like This

  • Retrieving data ...