使用Android中的asmack库重新连接到现有聊天室

时间:2015-05-26 06:19:02

标签: android asmack

我正在使用以下代码重新连接到现有聊天室..

try {
    mucChat = new MultiUserChat(connection,groupname+"@conference.serviceName");
    DiscussionHistory history = new DiscussionHistory();
        history.setMaxStanzas(30);
    mucChat.join("username", "password", history, SmackConfiguration.getPacketReplyTimeout());
    } catch (XMPPException e) {
        e.printStackTrace();
    }

但我无法获得历史记录......我正在ClassCastException获得

 @Override
 public void processPacket(final Packet packet) {
                final Message message = (Message) packet;
 }

抛出异常:

java.lang.ClassCastException: org.jivesoftware.smack.packet.Presence cannot be cast to org.jivesoftware.smack.packet.Message

0 个答案:

没有答案