Reputation: 29
This is stanza that create from api :
<message xmlns="jabber:client" to="[email protected]/84947029xxx52245593xxx" from="[email protected]">
<x xmlns="jabber:x:conference" reason="new group chat : mucduke" jid="[email protected]"></x>
<body>new group chat : mucduke</body>
</message>
I use connection.addAsyncStanzaListener(stanzaListener, stanzaFilter) in android to get the stanza but atribute 'reason' and body element if missing from stanza. Can anyone help me why this happen?
Upvotes: 0
Views: 968
Reputation: 1014
use following StanzaTypeFilter
for add addSyncStanzaListener
StanzaTypeFilter filter = new StanzaTypeFilter(Message.class);
mStanzaListener = new StanzaListener() {
@Override
public void processPacket(Stanza stanza) throws SmackException.NotConnectedException, InterruptedException {
onMessageReceived(stanza);
}
};
connection.addSyncStanzaListener(mStanzaListener, filter);
get stanza
onMessageReceived
public void onMessageReceived(Stanza stanza) {
if(stanza instanceof Message){
Message msg= (Message) stanza;
msg.getBody();
...
...
}
}
Upvotes: 2