Ok guys, a simple question, but very important to me.
so another android client sends this xml msg:
<message id='6ymdM-19' to=' xox@xox.xox /smack' type='chat'> <subject>normal</subject> <received xmlns='urn:xmpp:receipts' id='HVgQw-5'/> </message>
and my listener is something like this:
private class MsgListener implements ChatStateListener { public MsgListener() { } @Override public void processMessage(Chat chat, org.jivesoftware.smack.packet.Message message) { String xmlMessage = message.toXML(); Log.v(TAG, "XML Chat: "+xmlMessage);
in this case, I want to get the value of the "id" attribute, inside the "received" element tag. but what i got in my log is as follows:
RECEIVED notification arrived! D/ChatAdapter(320): Extension name: received D/ChatAdapter(320): Extension XML: <received xmlns="urn:xmpp:receipts"></received> D/ChatAdapter(320): Extension string: org.jivesoftware.smack.packet.DefaultPacketExtension@44f10430
So how can I get 'HVgQw-5' ??
UPDATE
There is actually something strange there ... I get xml accordinh from my SMACK debugging as follows:
< D/SMACK(320): 05:40:28 PM RCV (1156991856): message id="6ymdM-19" to=" syeikh@emass.sangkuriang.co.id /Smack" from=" emu22@emass.sangkuriang.co.id /Smack" type="chat"><subject> D/SMACK(320): 05:40:28 PM RCV (1156991856): normal</subject><thread>cr0900</thread> **<received xmlns="urn:xmpp:receipts" id="HVgQw-5"/>**<active xmlns="http://jabber.org/protoc D/SMACK(320): 05:40:28 PM RCV (1156991856): ol/chatstates"/></message>
But when I execute message.toXML, it just prints like this:
XML Chat: <message id="6ymdM-19" to=" syeikh@emass.sangkuriang.co.id /Smack" from=" emu22@emass.sangkuriang.co.id /Smack" type="chat"><subject>normal</subject><thread>cr0900</thread>**<received xmlns="urn:xmpp:receipts">**</received><active xmlns="http://jabber.org/protocol/chatstates" /></message>
Why is this happening? why am i missing the "id"?
user724861
source share