Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an account from Smack 4.1

I'm trying to create an account from Smack for Android on jabber.at. Here is my code :

XMPPTCPConnectionConfiguration conf= XMPPTCPConnectionConfiguration.builder()
                                .setServiceName("jabber.at")
                                .build();
XMPPTCPConnection connection = new XMPPTCPConnection(conf);

connection.addConnectionListener(xmppConnectionListener);
connection.connect();

AccountManager accountManager = AccountManager.getInstance(connection);
Map<String, String> map = new HashMap<String, String>();
map.put("username", usr);
map.put("password", pwd);
map.put("email", email);
accountManager.createAccount(usr, pwd, map);

I got an error:

W/System.err﹕ org.jivesoftware.smack.packet.XMPPError@2beba168
W/System.err﹕ at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:217)
W/System.err﹕ at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:198)

I have tried with and without the Map, same error. According to Mathias Ertl from jabber.at, it is possible to create accounts remotely, so I'm doing something wrong somewhere. Any idea ?

like image 692
guik Avatar asked Nov 10 '22 19:11

guik


1 Answers

check if your server support remote account creation.

accountManager.supportsAccountCreation()
like image 181
yuri andri gani Avatar answered Dec 24 '22 02:12

yuri andri gani