How to c my subscribed user as online?

I’'m having a bit complex scenario. In its end my subscribed user always apears as unavailable

I’'m doing the following:

user1 does roster.createEntry (user2)

user2 send presence subscribed package to user1

user1 see user2 as online

user 2 does roster.createEntry (user1)

user1 send presence subscribed package to user2

user2 do roster.removeEntry(user1)

user1 receives presence package from user2 with unsubscribe

user2 logs out user1 see user2 as unavailable

user2 logs in

user2 does roster.createEntry (user1)

user1 receives presence package from user2 with subscribe

user1 send presence subscribed package to user2

user2 does roster.getEntry().getPresence() and see user1 as available

user1 does roster.getEntry().getPresence() and see user2 as unavailable

Am I looking at the wrong place?

What am I doing wrong?

how can I fix this?

It may be a problem with timing. Depending on how quickly you are requesting the presence information from when you initially login the info might not have had time to be sent to you.

You can do a couple of things here, 1st you could just add a simple sleep call in between logging in and requesting the presence info or you could add a roster listener to your app, that way you’'ll receive the updated roster information when it becomes available.

Alternatively the above may have nothing to do with your problem at all

Jon