问题描述
我有问题,当想收到的消息,现在我能够收到消息,但一些attribut缺少
类MyMessageListener实现消息监听{
@覆盖
公共无效而processMessage(聊天,留言消息){
Util.DebugLog(MESSAGE->中+ message.toXmlns());
}
}
我得到的是
<消息[email protected] =聊天,从[email protected]/ff3b2485><车身ASDF =ASDF > AAA< /身体GT;< /消息>
talk_id和聊天式的内部邮件丢失。
这是要我要当收到消息
<消息[email protected] =聊天talk_id =304chat_type [email protected]/ff3b2485 ><车身ASDF =ASDF> AAA< /身体GT;< /消息>
虽然XMPP并未严格禁止通过添加自定义扩展一节的属性,以pre-定义的元素(的消息
你的情况),这是最好的添加自定义的数据作为额外的元素。这是大多数XMPP扩展设计。
因此,而不是
<消息[email protected] =聊天myCustomData =myvalue的><身体GT;您好!< / BODY><消息&GT ;
您
<消息[email protected] =聊天><身体GT;你好<!/身体GT;< myExtension myCustomData =myvalue的 />< /消息>
然后你只需要编写一个提供程序 myExtension
并注册它啪的的ProviderManager
。
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>
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
.
这篇关于消息监听didnt收到完整的邮件ASMACK的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!