I can't get addExtensionProvider to work

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.

XEP-198 enable/disable stanzas are top level XMPP stanzas and not packet extensions. Smack core needs to be modified in order to support them.

We are already working on xep198 support for Smack. If you would like to help use, simply join and idle around in #smack at freenode.

but chatsecure and yaxim has implemented this.
Any idea how they are doing this.

check:
http://yaxim.org/blog/2014/01/30/yaxim-0-dot-8-7-stream-management-and-more/

https://github.com/devrandom/ChatSecureAndroid/commit/4177009c9d66b43bf59b0cb08c e0e34e2bcf9f38

They use a patched version of aSmack

I also tried to put the same code like that with aSmack.
I am newbie in this and what do you mean by patched version.
Can I make my own patched version for this.
and what things I have to work on.
I also shared my problem on stackoverflwo can you please check that as well.
http://stackoverflow.com/questions/23222894/enable-stream-management-asmack-andr oid/23266891#23266891
and If they are using pacthed version why aSmack is not using this globaly for all its users.Is there any bug or side issues due to this patching.

and If they are using pacthed version why aSmack is not using this globaly for all its users.
Because custom patches versions tend to be ugly as they are usually quick and dirty implementations. The patch needs to be polished before it can get accepted by upstream.