I’m newbie of samck,and try to use smack 4.1.1 in my android project,I’ve did a little bit test about login exist user and sending message,everything seems ok.
but when i tried to use accountManager to create a new account,the createAccount func thrown an error: “bad-request-modify” if no existed user login at the first place.
I don’t know if i did something wrong.Can anyone help? thanks any way.
code likes this:
…
XMPPTCPConnectionConfiguration config …//
.......
mConnection = new XMPPTCPConnection(config);
mConnection.connect();//mConnect.isConnected == true
//mConnection.login("test1", "111111"); //test1 is exist,createAccount goes fine if uncomment this line otherwise createAccount throws "bad-request-modify"
AccountManager accountManager= AccountManager.getInstance(mConnection);
accountManager.sensitiveOperationOverInsecureConnection(true);
accountManager.createAccount("test2", "111111",mp);
Note1: see that username,name,password,email are variable that had the value of the text of the relative edittext. Hope it will help you
Note2: try to connect without setUsernameAndPassword() parameter of builder. Of course, you have to set the setting on openfire that you allow users to register.
I tried code suggested by Stefeno and finally able to solve problem after digging out server code. Problem was in client config(Smack SDK) before we connect to openfire.
I was passing incorrect service name in XMPPTCPConnectionConfiguration.setServiceName() which caused packets drops in IQRouter as client is not authenticated yet. Hope this helps someone!!