I am noob to android and SMACK . Don’t mind the silly doubts.
We are working on a chat app using XMPP and smack as XMPP client. We want the following functionality.
App should be in keep alive state.
App should remain connected to the server even if user closes the app in backgroud.
The only condition when it is disconnected is the user phone internet is not working or the server.
If the user logged in one time (while installing the app) then what should be the flow and where to place the code so the reconnection process happens at any activity through out the application .
Thanks @Paul_Schaub,
Just want to confirm that a normal ping manager code and disconnect handlers will work in the “sticky background service” you mention??
Or somthing else should be coded for this.
Staying connected all the time actually does not cost much battery at all (given the right protocol extensions like CSI, Stream Resumption are enabled).
My test application does not even show up in Androids battery stats.
And yes, you probably need a foreground service on some devices.