Skip to content Skip to sidebar Skip to footer

Smack - When To Call MultiUserChat.Join(...)

I'm a bit confused and can't find the answer in the docs. I'm developing a simple chat app for Android. I've created a group (muc) and everything works, but do I have to keep calli

Solution 1:

A (I Hope) complete explanation: short answer is yes.

When a persistent room is created on your server, and you logout or exit the room, you have to re-join each time. A logout or connection lose is obvious, but when you exit (leave) the room, you also won't receive messages directly from it (even though your still connected to the server), the server knows your id is affiliated with that MUC (as a member for example), but you're not inside it, for further info refer to the XEP about MUC, and also read about how your specific server implements it on your server docs (probably saves messages under a room-to-offline users, or something similar).

That is basically what happens in WhatsApp when you go in and out of group chats, but they also have their own custom way (the layer they built on top of the basic xmpp server) to let you know about unread messages, that includes both a service (you can see it in your phone in the general settings->apps) and push notifications.


Solution 2:

  1. Create Service
  2. Add your xmpp code in it, like login, one to one chat, MUC chat.

So even your app closed service will remain in background and you will be always connected to chatrooms.


Post a Comment for "Smack - When To Call MultiUserChat.Join(...)"