Skip to content Skip to sidebar Skip to footer

Sending And Receiving Custom Xmpp Iqs With Asmack On Android

Background: I have implemented one to one chat using aSmack for XMPP on Android. I am also able to send and receive IQ messages. The issue is: I am unable to send and receive cust

Solution 1:

The code is incomplete. addPacketListener() takes two arguments.

I suspect you don't register a provider for the custom IQ on the receiving side, that's why it returns <service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>

You may want to read some documentation:

Solution 2:

You need to use ServiceDiscoveryManager and register your custom namespace like this:

ServiceDiscoveryManagersm= ServiceDiscoveryManager.getInstanceFor(connection);
sm.addFeature("your:namespace");

Look at Smack sources, all internal IQ handlers add themselves as feature, match incoming query packets by namespace and build result or error reply.

Post a Comment for "Sending And Receiving Custom Xmpp Iqs With Asmack On Android"