2015-03-31 96 views
0

我正在创建新用户ejabberd server.The用户已创建。 在下面的代码中创建用户918,但没有保存属性。XMPP服务器:帐户已创建但属性未保存

ejabberd服务器的访问规则是:[register, [{allow,all}]]

但是,我一起传递与createAccount()属性,不要保存在ejabberd服务器上。

使用的库 - asmack-android-8-4.0.7,dnsjava-2.1.7。 XMPP服务器 - ejabberd 2.1.11

代码是

ConnectionConfiguration config = new ConnectionConfiguration("myserver.co"); 
    config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled); 
    conn1 = new XMPPTCPConnection(config); 
    conn1.connect(); 

    AccountManager accMan = AccountManager.getInstance(conn1); 
    Map<String, String> attributes = new HashMap<String, String>(); 
    attributes.put("phone", "237"); 
    attributes.put("misc", "123"); 

    accMan.createAccount("918", "hellopass", attributes); 

    conn1.login("918", "hellopass"); 
    accMan = AccountManager.getInstance(conn1); 
    Log.d(TAG, "acc IMEI " + accMan.getAccountAttribute("misc")); // null returned here 
    Log.d(TAG, "acc phone " + accMan.getAccountAttribute("phone")); // null returned here 

最后2行以上代码的发布,返回空值。

我不知道我错过了什么,以正确创建帐户属性也得到保存。

谢谢 Vilpesh。

回答

0

属性不存储在帐户中,而是存储在Vcard上。当你注册一个用户时,你只能通过用户名和密码。 对于用户信息,您应该查看设置您的Vcard。