I have created a user from openfire admin page. I have entered the username, NAME, email, password.
I am writing a client in Android. How can I get the NAME of the current user? I have tried:
(1) connection.getuser() – it returns: peter@www.abc.com/smack
(2) Get self vcard – it returns nothing related to the NAME
I can get the name of other users by RosterEntry.getName(). But how to get the name of current user?
Also, is it possible to get the status of current user? (like presence.getStatus())
You can get the name of the current user by using the AccountManager by using the getAccountAttribute and then specify the name of the attribute. In this case it is name”. Here is the code for simply printing the name of the current user
Regarding your second question you can of course know the other users’ presence in your roster by using roster.getPresence. Here is a simple loop to illustrate the use of this method