powered by Jive Software

MUCLight how to listen for incoming group chat message

android

#21
List<Jid> occupiedRooms = multiUserChatLightManager.getOccupiedRooms(JidCreate.domainBareFrom(ConstantXMPP.XMPPService.MUCLightService));
            for (Jid jid : occupiedRooms) {
                MultiUserChatLight multiUserChatLight = multiUserChatLightManager.getMultiUserChatLight(JidCreate.entityBareFrom(jid.toString()));
                MUCLightRoomConfiguration configuration = multiUserChatLight.getConfiguration();
                multiUserChatLight.addMessageListener(new org.jivesoftware.smack.MessageListener() {
                    @Override
                    public void processMessage(Message message) {
                        Log.e("Group message/n content", "" +  message.toXML());
                            if (message.getBody() != null && message.getBody().length() > 0) {
                                Log.e("Message Sender", message.getFrom().asBareJid().toString());
                                Log.e("Text Message", message.getBody());
                                handleGroupTextMessage(message);
                            }
                      }
                });
              }
}

In service this is how i am adding listeners to the muclight room and i am getting messages when the chat window is open, but as soon as i open the chat windows I don’t receive any packet,
and addMessageListener method actually put the message listener into

Set<MessageListener> messageListeners = new CopyOnWriteArraySet<MessageListener>();

so it is like handling all the listeners for each and every group, but still and one more thing, sometimes this thing works exactly as expected

@Paul_Schaub @CSH @Flow