MessageListener didnt receive full message ASMACK Android

403 Views Asked by At

i got problem when want to receive message, right now i am able to receive message, but some attribut is missing

    class MyMessageListener implements MessageListener {

    @Override
    public void processMessage(Chat chat, Message message) {
        Util.DebugLog("message->"+message.toXmlns());

    }

}

what i got is

  <message to="[email protected]" type="chat" from="[email protected]/ff3b2485"><body asdf="asdf">aaa</body></message>

talk_id and chat type inside message is missing.

This is want i want when receive message

  <message to="[email protected]" type="chat" talk_id="304" chat_type="0" from="[email protected]/ff3b2485"><body asdf="asdf">aaa</body></message>
1

There are 1 best solutions below

2
On

While XMPP does not strictly forbid extending a stanzas by adding custom attributes to pre-defined elements (message in your case), it's the best to add the custom data as extra element. This is how most XMPP extensions are designed.

So instead of

<message to="[email protected]" type="chat" myCustomData="myValue"><body>Hello!</body><message>

you have

<message to="[email protected]" type="chat"><body>Hello!</body><myExtension myCustomData="myValue"/></message>

Then you simply need to write a Provider for myExtension and register it with Smack's ProviderManager.