I am working on a GroupChat process. I have successfully sent the invitation and using PSI i have received this invitation. But M unable to invoke my own "MultiUserChat.addInvitationListener
". I have done this many ways but in-vain. Here is one of my attempt.
ProviderManager pm = ProviderManager.getInstance();
pm.addExtensionProvider("x", "http://jabber.org/protocol/muc#user", new MUCUserProvider());
MultiUserChat.addInvitationListener(mXmppConnection, MyClass.this);
And doing "MyClass extends Activity implements InvitationListener
"
@Override
public void invitationReceived(final Connection conn,final String room, final String inviter, String reason, String password, Message message) {
AlertDialog.Builder builder = new AlertDialog.Builder(MyClass.this);
builder.setTitle("Room Invitation");
builder.setMessage(inviter + " sent you an invitation to join GroupChat saying \""+reason+" \". \n Do you want to join "+inviter+"?");
builder.setPositiveButton("Accept", new DialogInterface.OnClickListener() {
// Joining Room
@Override
public void onClick(DialogInterface dialog, int which) {
try {
MultiUserChat multiUserChat = new MultiUserChat(conn, room);
multiUserChat.join(myNickName);
if(multiUserChat.isJoined()){
dialog.cancel();
}
} catch (XMPPException e) {
e.printStackTrace();
}
}
});
builder.setNegativeButton("Decline", new DialogInterface.OnClickListener() {
// Declining Room Invitation
@Override
public void onClick(DialogInterface dialog, int which) {
MultiUserChat.decline(conn, room, inviter, "I'm busy right now");
dialog.cancel();
}
});
builder.show();
}