AnsweredAssumed Answered

Smack 4.1.5 multiuserchat incoming message listner

Question asked by rajeesh on Jan 21, 2016
Latest reply on Jan 21, 2016 by rajeesh

Hi I  created a chat room and people are joined in this room. However I couldn't  receive any message sent to this room.

 

Following is my code.

 

Sending group message

 

MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);

MultiUserChat multiUserChat = manager.getMultiUserChat("roomname@conference.servicename");


Message message = new Message();
message.setBody(text);
message.setType(Message.Type.groupchat);

 

multiUserChat.sendMessage(message);

 

 

Receiving group message

 

MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
MultiUserChat multiUserChat = manager.getMultiUserChat("roomname@conference.servicename");

multiUserChat.addMessageListener(new MessageListener() {

   @Override
   public void processMessage(Message message) {

  Log.d("Message","received");
   }

});

 

 

This is not working. Later I tried to add a MessageTypeFilter but with the latest version its access is restricted as private and we couldn't make it.

 

I want to know what is the exact method to listen multiuser chat messages using smack 4.1.5.

 

Outcomes