powered by Jive Software

Smack android incoming onStanza is different from debugger

The Gajim client on windows and smack debbuger return this kind of stanza, same as the one in the xmpp specs.

Hail to thee

yet on smack in onStanza it returns this one:

Hail to thee

How do you fix this? Here’s some parts of the code.

public class XmppServiceSmackImpl implements XmppService, StanzaListener, ConnectionListener {

XmppServiceListener xmppServiceListener;

Logger logger = Logger.getLogger(XmppServiceSmackImpl.class.getName());

XMPPTCPConnection connection;

String password;

public XmppServiceSmackImpl(XmppServiceListener xmppServiceListener) {

this.xmppServiceListener = xmppServiceListener;



public void setup(String jid, String password, String authMethod, String hostname, Integer port) {

final String[] jidParts = jid.split("@");

String[] serviceNameParts = jidParts[1].split("/");

String serviceName = serviceNameParts[0];

XMPPTCPConnectionConfiguration.Builder confBuilder = XMPPTCPConnectionConfiguration.builder()


.setUsernameAndPassword(jidParts[0], password)




if (serviceNameParts.length>1){


} else {

confBuilder.setResource(Long.toHexString(Double.doubleToLongBits(Math.random()) ));


if (hostname != null){



if (port != null){



if (trustedHosts.contains(hostname) || (hostname == null && trustedHosts.contains(serviceName))){



XMPPTCPConnectionConfiguration connectionConfiguration = confBuilder.build();



connection = new XMPPTCPConnection(connectionConfiguration);

// Disable automatic roster request

Roster roster = Roster.getInstanceFor(connection);



connection.addAsyncStanzaListener(this, null);





public void processPacket(Stanza packet) throws SmackException.NotConnectedException {

logger.log(Level.WARNING, "Received stanza: " + packet);




There is most likely no provider for registered.

what are providers? i cant find any concrete examples

also why are the attributes missing

belongs to XEP-0280
In SMACK, it’s an experimental feature.
you need additional library in your build.gradle

dependencies {
compile “org.igniterealtime.smack:smack-android-extensions:4.2.0”

Before you do any thing with SMACK, you have to initialize experimental feature:

new ExperimentalInitializer().initialize();

By the way, provider is a plugin-like stanza handler
When you want to use customized stanza between your client and server.

You have to write your own provider to parse it into extension element that under Message object.
Take a look at ProviderManager.

i upgraded to 4.2.0 and added changes to the API and im getting my desired stanza

turns out 4.2.0 adds support for mam and additional providers for

Gary Lin wrote:

Before you do any thing with SMACK, you have to initialize experimental feature:

new ExperimentalInitializer().initialize();

You shouldnt need to do that. Smack does it automatically for you.