How to unload an extension provider and load an alternate for it

SmackConfiguration.getVersion(); //to init the static codes

ProviderManager.removeExtensionProvider(“x”, “jabber:x:data”);

ProviderManager.addExtensionProvider(“x”, “jabber:x:data”, new CustomDataFormProvider());

will the above code work

if not …(it is not working)

then which place we should do this, without modifying the code and without modifying extensions.providers and without modifying extensions.xml?

I see no reason why the above code shouldn’t work. You can even drop the removeExtensionProvider, adding a provider will override the existing ones, and you don’t need to call getVersion, as it’s already done in a static code block within ProviderManager.

not working

my doubt is

should we do it after establishing connection or before or after setting configuration or before sending stanza…?

any clue, to achieve this?

it seems ProviderManager.addExtensionProvider(“x”, “jabber:x:data”, new CustomDataFormProvider()); is not enough

ProviderManager.addIQProvider(“command”, “”, new CustomAdHocCommandDataProvider());

ProviderManager.addExtensionProvider(“x”, “jabber:x:data”, new CustomDataFormProvider());

now it is working

Yep, it appears that the DataFormProvider is hardcoded into the commands provider: Smack/ at 64d134052dbd39a2933e3e7b4fe6a65bfa3cc1f1 · igniterealtime/Smack · GitHub

It should be changed.

But then again, if you need to replace the data form provider, then you are most likely doing something non-standard XMPP, which I don’t recommend to do. Why do you feel like replacing it?