I 开发者_如何转开发use asmack building a jabber client for android, it works well ,but I got a problem when sending a large text in Chinese. The XMPPConnection just disconnected from server immediately,here are my Codes of Connection initialization:
ConnectionConfiguration c = new ConnectionConfiguration(mServerAddress, mPort);
c.setSecurityMode(SecurityMode.disabled);
c.setReconnectionAllowed(true);
c.setCompressionEnabled(false);
mConn = new XMPPConnection(c);
and I send a chat message like this:
final Message msg = new Message(chatMsg.getTo(), Message.Type.chat);
msg.setBody(chatMsg.getBody());
new Thread() {
@Override
public void run() {
if(mConn != null && mConn.getUser() != null) {
mConn.sendPacket(msg);
}
}
}.start();
精彩评论