12-13 21:24:34.720: D/RegisterTask.PacketListener(3144): packet=<iq id="8dMsj-0" from="kwant.cn" type="error"><query xmlns="jabber:iq:register"><password>abc</password><username>abc</username></query><error code="400" type="MODIFY"><bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
12-13 21:24:34.720: E/Androidpn_XmppManager(3144): Unknown error while registering XMPP account! bad-request
提示XMPP connected successfully,但login的时候一直登录不上,不知为什么。
------解决方案--------------------
我使用下面的代码来连接,使用 android 中 Smack API登录:
private XMPPClient xmppClient;
private XMPPConnection connection;
private ArrayList<String> messages = new ArrayList();
public void login(String userName, String password) throws XMPPException
{
ConnectionConfiguration config = new ConnectionConfiguration("HOST",PORT, "SERVICE");
connection = new XMPPConnection(config);
connection.connect();
//LOGIN USING THE FOLLWING login()
connection.login(userName, password);
xmppClient.setConnection(connection);
}