How to register a new user on XMPP using (a)Smack library

前端 未结 9 1094
南笙
南笙 2020-12-28 19:10

I have set up a xmpp server and android client using the great post here... I have some pre defined users set up in the xmpp server and i could login with those credentials.

9条回答
  •  醉话见心
    2020-12-28 19:46

    I want to update the answer to reflect the change in Asmack library version 4.0 onward. Connection.getAccountManager() is now AccountManager.getInstance(XMPPConnection)

    AccountManager accountManager=AccountManager.getInstance(connection);
    try {
        accountManager.createAccount("username", "password");
    } catch (XMPPException e1) {
        Log.d(e1.getMessage(), e1);
    }
    

提交回复
热议问题