вам нужно автоматически присоединиться при получении приглашения, вот код, пока соединение установлено.
MultiUserChatManager.getInstanceFor(MyApplication.connection).addInvitationListener(new InvitationListener() {
@Override
public void invitationReceived(XMPPConnection conn, MultiUserChat room, EntityJid inviter, String reason, String password, Message message, MUCUser.Invite invitation) {
// Log.e(TAG, "invitationReceived() called with: conn = [" + conn + "], room = [" + room + "], inviter = [" + inviter + "], reason = [" + reason + "], password = [" + password + "], message = [" + message + "], invitation = [" + invitation + "]");
LogM.e("invitationReceived() called with: conn = [" + conn + "], room = [" + room + "], inviter = [" + inviter + "], reason = [" + reason + "], password = [" + password + "], message = [" + message + "], invitation = [" + invitation + "]");
try {
Resourcepart nickname = null;
try {
nickname = Resourcepart.from("MY_JID_HERE");
} catch (XmppStringprepException e) {
e.printStackTrace();
}
try {
room.join(nickname); //while get invitation you need to join that room
room.getRoom().getLocalpart();
} catch (SmackException.NoResponseException e) {
e.printStackTrace();
} catch (SmackException.NotConnectedException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (MultiUserChatException.NotAMucServiceException e) {
e.printStackTrace();
}
Log.e(TAG, "join room successfully");
} catch (XMPPException e) {
e.printStackTrace();
Log.e(TAG, "join room failed!");
}
}
});