【发布时间】:2015-01-29 09:11:31
【问题描述】:
我正在尝试使用 Type.headline
发送消息这是我的代码:
public boolean sendText(Chat chat, String text) {
Message message = new Message();
message.setBody(text);
message.setType(Message.Type.headline);
message.setPacketID("id123456");
try {
chat.sendMessage(message);
Log.d("TAG", message.toXML().toString());
return true;
} catch (SmackException.NotConnectedException e) {}
return false;
}
但是发送的 XML 是这样的:
<message id='id123456' to='roee@192.168.0.3' type='chat'>
<body>test message</body>
<thread>ed108b04-4488-423a-a441-ca95284db6c1</thread>
</message>
如您所见,在 XML 中 type='chat' 而不是 type='headline'。
为什么会这样,我该如何改变它?
【问题讨论】: