2
votes

Hi Im using the Smack XMPP library for android.

I have figured out how to connect, login and create a user, but if I try to create an account with a username that already exist, i get a 'conflict' error, then if i change the username and try again, im locked out for about 10 mins, with a "not_acceptable - wait" error.

So how would i check if the username exists before creating an account?

1

1 Answers

0
votes

You can use Roster as:

  1. Create a side account.
  2. Add all accounts to the roster of the account created previously.
  3. Check if the username exists with :

    Collection<RosterEntry> re = roster.getEntries();
    

    And then search for the username in "re".

EDIT : Or simply you can use userSearchManager