2016-08-09 15 views
-1

私はOpenfireとXMPPで作業しています。私の問題は、誰かにサインをしたいときはいつでも、私はこのようにOpenfireにログインする必要があります。XMPP - 新規ユーザーの登録

connection.login(Username, Password); 
      AccountManager accountManager = AccountManager.getInstance(connection); 
      accountManager.createAccount(Username1, Password1); 

どうすればこの無駄なログインを回避できますか?

ありがとうございます。

答えて

1

ログイン機能をcreateAccount()から分割する必要があります。

あなたは(ユーザー名とパスワードを提供せずに)Openfireサーバに接続する必要があり、その後、createAccount

//...connection builder 
    connection.connect(); 
AccountManager.getInstance(connection).sensitiveOperationOverInsecureConnection(true); 
      username = username.toLowerCase(); 

       Map<String,String> attributes = new HashMap<String, String>(2); 
       attributes.put("name", fullName); 
       attributes.put("email", email); 
     AccountManager.getInstance(connection).createAccount(username, password, attributes); 
//now you can do connection.login(username,password) 
を求めます
関連する問題