Question

I've spend some time to add smack.providers in the android device, which is picked up by my application just fine. I've added the default iqProviders and extensionProviders, but I've also added my custom extensionProvider, which is the following:

<extensionProvider>
  <elementName>players</elementName>
  <namespace>boxer:players</namespace>
  <className>company.games.boxer.PlayerListProvider</className>
</extensionProvider>

Let me also introduce the PlayerListProvider class, which is currently there just to see if it will get called (which it doesn't) - I'll implement it fully when I'll know it gets called, therefore at least that part of functionality works:

import java.util.List;
import java.util.Map;

import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smackx.provider.EmbeddedExtensionProvider;

import android.util.Log;

@SuppressWarnings("deprecation")
class PlayerListProvider extends EmbeddedExtensionProvider {
  protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String,String> attributeMap, List<? extends PacketExtension> content) {
    Log.w("***** AAAAAAAAAAAAAAAAAAAA *******", "0");
    return new XMLPlayerList();
  }

}



class XMLPlayerList implements PacketExtension {

  public String getElementName() {
    return "aaaaa";
  }

  public String getNamespace() {
    return "aaaaa";
  }

  public String toXML() {
    return "aaaaa";
  }

}

And I'm getting the following message when I run the client android app:

<message to="eee@localhost" type="chat" id="9" from="admin@localhost">
  <body>
    &lt;players xmlns="boxer:players" command="playerlist"&gt;
      &lt;player&gt;test1&lt;/player&gt;
      &lt;player&gt;test2&lt;/player&gt;
    &lt;/players&gt;
  </body>
  <thread>3P0i00</thread>
</message>

My question now is, why isn't the PlayerListProvider (EmbeddedExtensionProvider) called upon receiving the message. The message contains the tag and has the namespace of boxer:player, as I specified in smack.providers.

Any thoughts?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top