Facebook asmack xmpp client returns random numbers for roster

无人久伴 提交于 2019-12-03 21:18:28

It sounds like you just want to readable name, so try using

rosterEntry.getName()

which returns the users name, instead of

rosterEntry.getUser()

which returns the JID.

Not sure about your offline problem though. How are you checking? You have to set up a roster listener to get changes in presence.

Its a bug in XMPP library . There is a work around for that .

Step 1: Connect to XMPP.

Step 2: Login to facebook account through xmpp.

Step 3: get online friend list using this fql query .

    SELECT uid, name, online_presence ,
      sex FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())

Then i concat address with string uid@chat.facebook.com and communicate via XMPP.

(It's not 100% clear what problem you're having regarding the online/offline thing may be a bug or something you're doing incorrectly), but you won't get back the user's actual user IDs in the response, this is mentioned in the docs:

The user's own Jabber ID (JID) is different from the Jabber ID that their contacts will see because the translation is done internally.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!