【问题标题】:Invitation Listener not working smack 4.1邀请侦听器无法正常工作 4.1
【发布时间】:2016-12-28 03:43:49
【问题描述】:

我在我的应用程序中使用 smack 4.1, 我可以发送邀请,但收不到邀请

事实上,在调试时,我在ChatMessageListener() 中收到了邀请 ,在数据包扩展中,我可以获得整个邀请,但我不想解析 XML。

我的InvitationLisenter()从不被调用

final MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
    manager.addInvitationListener(new InvitationListener() {
        @Override
        public void invitationReceived(XMPPConnection xmppConnection, MultiUserChat multiUserChat, String s, String s1, String s2, Message message) {
            try {
                multiUserChat.join(mUserName);
            } catch (SmackException.NoResponseException e) {
                e.printStackTrace();
            } catch (XMPPException.XMPPErrorException e) {
                e.printStackTrace();
            } catch (SmackException.NotConnectedException e) {
                e.printStackTrace();
            }
        }
    });

【问题讨论】:

    标签: java android xmpp smack


    【解决方案1】:

    在 xmpp 中有两种类型的房间邀请,

    直接邀请

    作为普通消息发送并使用ChatMessageListener() 接收 ,我正在使用此代码从消息中获取邀请

    GroupChatInvitation invite = (GroupChatInvitation)result.getExtension("x","jabber:x:conference");
    


    中介邀请

    通过InvitationLisenter()接收

    【讨论】:

      猜你喜欢
      • 2017-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-14
      • 2021-01-31
      • 1970-01-01
      • 2023-03-18
      • 1970-01-01
      相关资源
      最近更新 更多