When the app is in the background and xmpp disconnects because the internet goes down, and if the internet comes back up, when I open the app, the disconnect call is not made so the app doesn't try to reconnect.
If i check the xmppstream is connected it shows as Yes. How can I check if the connection is still alive when I go back to the app?
Currently I am trying a disconnect, and connect each time the app wakes up. But ideal would be to detect disconnection...
Thanks
If you can detect when the app wakes up, then send a ping. If you don't get a reply, reconnect. If the XMPP lib you use has support for Stream Management, especially the stream resumption support, you could use that to pick up the stream.
A better solution would be to have a separate daemon that manages the connection, and stays alive in the background, if that's even allowed on iOS. Also, this XEP might be of interest.