powered by Jive Software

Add User to Roster(Group) in Smack

I am currently using asmack to create a chat app.

I want to create a user log in and then assign him to a specific Group/Roster. I have successfully created the user and logged in.

However, when I try to assign the user to the Group/Roster he is only assigning him for that current session (with the status “subscribed”) and when I log into the openfire server he is not shown in the group…I am not receiving any errors when calling createEntry.

Also I downloaded a plug in on the openfire server that accepts all subscription automatically.

Thanks for your help!

`AccountManager am = new AccountManager(m_connection);
am.createAccount(mUserName, “1234”);

m_connection.login(mUserName, “1234”);
Roster roster = m_connection.getRoster();
String[] urlArray = new String[] { “group” };

roster.createEntry(mUserName, mUserName, urlArray);
Collection str = roster.getEntries();
for (RosterEntry r : str)

   Log.d(TAG, "RosterEntry: " + r.getName());
   Log.d(TAG, "RosterEntry: " + r.getUser());
   Log.d(TAG, "RosterEntry: " + r.getStatus());