java - XMPP register new user -
i having lots of trouble xmpp, new , examples have found have account connect , things.
my problem concerns new users. not have account needs able register himself , log in. have understood, first need create connection before can create users. without account can not create one.
some links have been reading:
https://code.google.com/p/lxmppd/issues/detail?id=328
https://davanum.wordpress.com/2007/12/31/android-just-use-smack-api-for-xmpp/
http://www.igniterealtime.org/builds/smack/dailybuilds/documentation/connections.html
so basically, need create connection without user login. create user , login user.
so found this:
but seems accountmanager class outdated or because cannot find in same path. (http://www.igniterealtime.org/builds/smack/docs/4.0.6/javadoc/org/jivesoftware/smack/accountmanager.html)
so question is: how create new account , login it(from new users perspective)?
a small code snippet or link source highly appreciated.
edit 1: have gotten point:
xmpptcpconnectionconfiguration config = xmpptcpconnectionconfiguration.builder() .setservicename("jabber.org") .sethost(appconfig.xmpp_host) .setport(integer.parseint(appconfig.xmpp_port)) .build(); xmppconnection connection = new xmpptcpconnection(config);
now need instantiate accountmanager object not available in smack 4.1
i trying follow example: how create account smack 4.1
and though read should in smackx. thing can find in smackx is:
import org.jivesoftware.smackx.debugger.android.androiddebugger
creating account works first connecting server , then initializing account creation. essentially, create connection in can create account, , proceed create said account. here's how it:
xmpptcpconnectionconfiguration conf = xmpptcpconnectionconfiguration.builder() .setservicename(service_name) .sethost(host_name) .setport(5222) .setsecuritymode(connectionconfiguration.securitymode.disabled) .build(); abstractxmppconnection connection = new xmpptcpconnection(conf); connection.connect(); // here create connection // create account: accountmanager accountmanager = accountmanager.getinstance(connection); accountmanager.createaccount(username, password); // account has been created, can login connection.login(username, password);
so first initialized connection, created account, , logged in. helps
Comments
Post a Comment