Hello,
Let me show you my code first and explain my case:
this.messagePacketListener = new PacketListener()
{
public void processPacket(Packet packet)
{
if (packet instanceof Message)
{
Message message = (Message) packet;
MessageProcessor.MessageDispatcher(message);
}
else
{
String pp = "pp";
}
}
};
That’s my packetListener, which will process messages and do something meaningless with other packages so that it will stop at debug time so I can check what’s being “listened to”.
This is how I add that packetListener:
this.connection.addPacketListener(this.messagePacketListener, null);
Messages are processed just fine. IQs, presences and some other stuff goes into the else clause of the processPacket method just fine as well. Now my problem:
I am sending this to the XMPP server:
<enable xmlns='urn:xmpp:sm:3' resume='true'/>
To which it is replying the following:
<enabled xmlns='urn:xmpp:sm:3' id='g2gEbQAAACgxM2U3NDEwOGU1NjAyMGYwMzg0ZDQ3YmFlODlkZGJkNjg3YzI2MzIybQAAAAZ3b293b3NtAAAABVNtYWNraANiAAAFdmIAA/u8YgAEmI8=' resume='true' max='300'/>
And here comes my problem, I am unable to catch that response through my application’s PacketListener, I know the response is there because I can see it the DEBUG logcat but that’s the end of it. I understand that I have to add an ExtensionProvider to ‘catch’ that message but I am unable to catch it. This is how I have implemented it. Before my connection is created I do this:
addSimplePacketExtension("enabled", "urn:xmpp:sm:3");
which adds an ExtensionProvider to the ProviderManager like this:
private static void addSimplePacketExtension(final String name, final String namespace)
{
PacketExtensionProvider packetExtensionProvider = new PacketExtensionProvider()
{
public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
Log.v(TAG, "We're inside parseExtension");
// do something etc
return packet;
}
}; ProviderManager.getInstance().addExtensionProvider(name, namespace, packetExtensionProvider);
}
ParseExtension inside PacketExtensionProvider is never reached and I don’t know what else to do. Any help is greatly appreciated.
Thanks for your time.