How to get registered users from openfire server using smack4.1

Hi,

i am using smack4.1 to make a chat app.

i created some users through android client.

i tried to retrieve all existing users from openfire server. i checked api but unable to find which class is useful to get all existing users.

Please help me how to retrieve all created users after making the connection to check the duplication of user entries while registration.

Thanks in advance…

@androidBee

i am new to use openfire server …

i have successfully configure openfire 3.10.0 in my localhost …

now i want create a Android client for chat application …

i m familiar with Eclipse IDE and Android Studio , Latest android SDK …

since last few days i am finding " how to create new user from android ".… everyone say like you **" i created some users through android client " **

can you suggest me some links , document any kind of code that help me to write a code for Create new User from android

Thanks In Advance … !!

@hardik

you can create user using AccountManager class.

Ex (this code based on smack4.1):

after creating the XMPP connection

AccountManager accountManager = AccountManager.getInstance(mConnection);

Map<String, String> map = new HashMap<String, String>();

map.put(“username”, usr);

map.put(“name”, usr);

map.put(“password”, pwd);

map.put(“email”, eml);

accountManager.createAccount(usr, pwd, map);

1 Like

Thanks it’s work Like a Lucky Charm … !!

@androidbee

While creating of new user using android client, i am using your code i am getting error at AccountManager.getInstance(conncetion).

Error is “The method getInstance(XMPPConnection) is undefined for the type AccountManager”

and i am using same smack4.1 jar file .

appreciate for your reply

I’ve solved this issue in this way:
add the library “smack-extensions-4.1.1.jar” and “smack-im-4.1.1.jar” (i dont know which of the two is the one that you need).
Import this class on your class: import org.jivesoftware.smackx.iqregister.AccountManager;

This error came because you had import “android.accounts.AccountManager” instead the smack one.