Account manager callback?

I wanted to create account on my XMPP server (ejabberd); which is being created successfully via the following code:

XMPPTCPConnectionConfiguration conf= XMPPTCPConnectionConfiguration.builder()

.setServiceName(SERVICE)

.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)

.setDebuggerEnabled(true)

.build();

XMPPTCPConnection connection = new XMPPTCPConnection(conf);
try {

connection.connect();

AccountManager accountManager = AccountManager.getInstance(connection);
accountManager.sensitiveOperationOverInsecureConnection(true);
Map<String, String> map = new HashMap<>();
map.put(“username”, user);
map.put(“password”, password);
map.put(“email”, email);
accountManager.createAccount(user, password, map);
} catch (SmackException e) {

e.printStackTrace();
} catch (IOException e) {

e.printStackTrace();
} catch (XMPPException e) {

e.printStackTrace();
}

But how to know when the account is created successfully or not? Is there any callback? I didn’t find any, so I am asking this question here.

I want to user to navigate to next screen when account is created successfully but unable to do so since I don’t know if account is created or not.

If there’s no exception, account creation should have been successful.

@CSH Thanks for your reply.

I understand that if there is no exception, it should be successful.

But we don’t know how much time it will take to create account. If user has slow connection it might take time, if user is on WiFi it will be fast; so even if I want to show “Please wait…” dialog, for how long should I show it? It depends on connection speed.

You are not sending tens of megabytes when creating an account though. It still should be fairly quick on a slow connection i believe. Or you can show a dialog for say 5 secs and wait for an exception during that time (or 10 secs to be sure).

Alright! I will do that. Thanks