AnsweredAssumed Answered

Send messages to groups after a reconnect not working

Question asked by Elias on Nov 10, 2016
Latest reply on Apr 28, 2017 by CSH

Good morning,
I have a problem wiht groups, I'm trying to make groups "re-join" work, without success.

 

What I do, is genral lines: Login --> launch joinGroups, and attach listeners --> jump to main activity. If app don't loose connection, it works OK, but when it loose connectivity, then joing the group is not  working. I try to send a message to group, and it return <error code = "406">

 

<message to="xxxx@cxx.xx/android" id="01VY2-84" type="error" from="grupoooo@conference.xx.xx"><body>Hola </body><error code="406" type="modify"><not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></message>

 

I search about, it and I saw this problem was solven in Smack 4.2.X, but I still can make it work.

 

Some considerations: Rooms are not created from android client, are always created by server, or other client like iOS. and are supossed to be created without password., and general reconnection works OK, because is still possible to chat 1v1 .

Here is how I connect to room:

 

public void createGroupChat(EntityBareJid gJid){

    MultiUserChat chatRoom = this.multiUserChatManager.getMultiUserChat(gJid);

    try {

        chatRoom.addMessageListener(new MessageListener() {

            @Override

            public void processMessage(Message message) {

                connectResponse.newMessageReceived(new ChatMessage(message));

            }

        });

        leaveGroupChat(gJid);

        chatRoom.join(this.connection.getUser().getResourcepart());

        } catch (XMPPException.XMPPErrorException | SmackException e) {

        Logger.e("ROOM:" + gJid + "\n" + e.getMessage());

        e.printStackTrace();

    } catch (InterruptedException e) {

        e.printStackTrace();

    }

}

 

I have forget somtehing?

Outcomes