Class LastActivityManager


  • public final class LastActivityManager
    extends Manager
    A last activity manager for handling information about the last activity associated with a Jabber ID. A manager handles incoming LastActivity requests of existing Connections. It also allows to request last activity information of other users. LastActivity (XEP-0012) based on the sending JID's type allows for retrieval of:
    1. How long a particular user has been idle
    2. How long a particular user has been logged-out and the message the specified when doing so.
    3. How long a host has been up.
    For example to get the idle time of a user logged in a resource, simple send the LastActivity stanza to them, as in the following code:
     XMPPConnection con = new XMPPTCPConnection("jabber.org");
     con.login("john", "doe");
     LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org/Smack");
     
    To get the lapsed time since the last user logout is the same as above but with out the resource:
     LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org");
     
    To get the uptime of a host, you simple send the LastActivity stanza to it, as in the following code example:
     LastActivity activity = LastActivity.getLastActivity(con, "jabber.org");
     
    See Also:
    XEP-0012: Last Activity