Android : Android aSmack Message.setType() doesn't work

on Thursday, January 29, 2015


I'm trying to send a Message with Type.headline


This is my code:



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;
}


But the XML that is sent, looks like this:



<message id='id123456' to='roee@192.168.0.3' type='chat'>
<body>test message</body>
<thread>ed108b04-4488-423a-a441-ca95284db6c1</thread>
</message>


As you can see, in the XML type='chat' instead of type='headline'.


Why is that and how do I change it?


0 comments:

Post a Comment