2013-07-01

Fix asmack invitationListener does not working on Android

Smack is a good java based library for XMPP client.
http://www.igniterealtime.org/projects/smack/

Android patched version here, called asmack
https://code.google.com/p/asmack/

But there is one issue I met when using MultiUserChat, the invitationListener won't work by using these code:
XMPPConnection mConnection = new XMPPConnection(config);
mConnection.connect();
mConnection.login(login, password, resource);
MultiUserChat mcu = new MultiUserChat();
...
mcu.addInvitationListener(mConnection, mInvitationListener);
mInvitationListener won't get called. So I cannot receive any invitation for group chat.

After done a research from google:
https://code.google.com/p/asmack/issues/detail?id=36

Solution is to add a ProviderManager before register InvitationListener
ProviderManager pm = ProviderManager.getInstance();
pm.addExtensionProvider("x", "http://jabber.org/protocol/muc#user", new MUCUserProvider());

No comments: