Search code examples
androidxmppsmackasmack

How do I keep a user permanently online with Smack on Android?


Okay here is my problem where i am stuck for so many days.

I am developing a simple chat application with the help of XMPP client - SMACK. Everything works fine for me normal chat process from one friend to another, also added the notification part.

What i am not able to do is if i forcibly close my application the whole session with SMACK stops.

I am not able to send the message to the user who had closed the application. Now, how do i keep the status of the user permanently online so the he can also receive messages even if he had closed the application.


Solution

  • You can't. If the application is closed, the user is no longer online and the server knows that. You can still send them messages, but it is the servers job to store offline messages, but that means the server has to be configured to do so.

    They can be retrieved once the user connects again.