简体   繁体   中英

How to enable/disable LastSeen in openfire XMPP

How can I enable and disable the last seen of the user in XMPP Android and iOS. I tried to disable LastActivityManager but it is not working.

There is also an option to setLastActivity in smack. I also set -1 in that but it is not working.

Also, I changed the presence and subscription of the user and tried all the way.

So is there any setting/configuration for last seen in XMPP or we need to manage it in the traditional API way?

As per XEP-0012 , User A can query Last Seen Time of User B, only if User A has subscribed to Presence of User B.

Presence States:

  • User A send presence subscription request to User B, User B accepts it. (User A can view last seen of User B)
  • User B also sends presence subscription request back to User A, User A accepts it. (User B can now also view last seen of User A).

XMPP Servers (Openfire, Ejabberd) have implemented this same logic as defined by the XEP.

So in your application, you need to handle presence subscription/unsubscription for allowing/disallowing last seen between users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM