Not logged in. · Lost password · Register
Forum: MatriX RSS
retrieve presence of roster after RequestRoster() done
Avatar
tongweng #1
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to request presence for Roster
Hi Sir Alex,

My name is tong weng, currently i am using your Matrix to build an android app. There are some problem currently i am encountering, which is I cant get presence of my roster after login.

I am using spark to test with my app. I only able to detect roster presence on the conditions stated below

i) User in my roster online/offline
ii) User in my roster change status

But i would like to make it look like IM , would show presence after request roster finish.

Thanks in advance
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
After successful login the server sends you automatically the presence of all you contacts you are subscribed to properly.
You get this presence in the OnPresence event. So consider all your contacts as offline by default and then set the presence state you get in the OnPresence event. Whenever a contact changes its presence you get the OnPresence event again immediately.

If you can't get it working then please attach a complete Xml log of a session where some of your contacts are online.
Avatar
tongweng #3
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
Yes i am able to capture the presence changes in OnPresence. But currently the situation i am encountering, is where i got my spark id logged in. Then i login with my apps again. After login, i will enter roster page where user can see his/her friendlist. In that part i should be able to get presence of my roster instead of waiting them to change their Show state? I am worry that its because of Open fire are unable to broadcast my roster's presence.

Hope i explained it clearly.
Avatar
Alex #4
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
whenever you login the server MUST send you the presences of all your contacts automatically after successful login.
When you get no presence automatically then either your server is buggy or you do something wrong in your codes. A Xml log will help there.
Avatar
tongweng #5
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
Oh i must be misunderstand the flow. I set the Presence handler after the connection Establish. Thats why i am not receiving any presence. Meaning that i need to move presence handler to the other class. Once again thanks for the help
Avatar
Alex #6
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
correct, setup the handler before you call Open on the XmppClient.
Avatar
tongweng #7
Member since Oct 2013 · 4 posts
Group memberships: Members
Show profile · Link to this post
I am able to retrieve presence now. Thanks for the help
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS