Hi Guys,
Our team has working on IM app based on XMPP. We have used smack for that on the client side. These are some important highlights about our connection.
Client sends Pings every 5 sec to check the network connection.
Client has used reconnectionManager from the smack library.
Client also using Stream management.
We are observing the following problems.
The connection on the mobile remains for 6 to 7 hours but then it disconnects and does not reconnect.
Pings from the server are failing after a long period of connectivity.
The ReconnectionManager is trying the multiple reconnects and enables a new stream 5 to 9 times and then sends the request which is totally not expected.
What are the points we are lagging so that we can build a persisitent connection in android which remains for endless period of time.
For the sake of battery consumption please use a higher ping interval. Something like 15/30 minutes scheduled by Android’s AlarmManager, which gives Android the opportunity to batch those, is sensible. Everything lower 15 minutes is just impolite towards the user.
Am also learning so I don’t have much to say. But I’m also curious how do you manage when there is no connection like user turns off the WiFi/Data for long time and re-switches on. I know you can listen to than and recreate connection, but where do you store user credentials for re-login? Or you just log user out and ask for new login?