I’m trying to use the LastActivityManager.getLastActivity to try to find out if a particular user is online or offline. I’ve looked around on how to use my Admin account to get Presence status (Online, Offline, etc) of any arbitrary user in the system but without them being on the admin’s Roster. If getLastActivity works, i can determine if a user’s online by checking if activity.lastActivity == 0.
At least that’s the plan, but I’m not able to get this working.
I’m using the code similar to below:
ConnectionConfiguration connectConfig = new ConnectionConfiguration(“localhost”, 5222, “MyTestDomain”);
XMPPConnection connection = new XMPPConnection(connectConfig);
connection .login(“Admin”, “MyAdminPassword”);
LastActivity activity = LastActivityManager.getLastActivity(connection, );
The admin login succeeds but when I make the getLastActivityCall, I get an XMPPException with a “forbidden(403)” message
I’ve tried this on OpenFire and Jabber2 and I get same failure messages on both side.
Is there something that I’m doing wrong or do I need some specific server config to enable the LastActivityManager functionality.
Anyone know of an alternative to getting Presenece info for users not in your roster. Basically I’m looking for something similar to
admin#get-online-users that is defined in Service Adminstration extension XEP-0133 http://www.xmpp.org/extensions/xep-0133.html#get-online-users-list