【发布时间】:2015-03-31 04:23:31
【问题描述】:
我正在 ejabberd 服务器上创建新用户。用户已创建。 在下面的代码中,创建了用户 918,但没有保存任何属性。
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
上面贴的最后两行代码,返回空值。
我不知道我缺少什么才能正确创建属性也被保存的帐户。
谢谢 维尔佩什。
【问题讨论】:
标签: android xmpp ejabberd asmack