Hi, I have a xmpp server and I’m using smack for the client and everything works great! except when I want to disconnect because when the client has internet connection it successfully disconnect but if the user want to disconnect and It doesn’t have internet I don’t know how to properly disconnect because as soon as the internet comes back it is still connected.
Here is how I disconnect.
if ( this.mConnection.isConnected()) // it crashes without this
this.mConnection.disconnect();
Basically the socket is being forcefully closed with the server, so in a sense you are disconnected.
If it’s connected when the internet comes back you probably have resumption activated, try disabling that feature. Also you can control that with Android’s connectivity manager and you can disconnect after a connection loss correctly if that’s what you want.