AnsweredAssumed Answered

How to correctly disconnect from aSmack

Question asked by patrik on Oct 6, 2014
Latest reply on Oct 6, 2014 by dharmendra

I have running aSmack 8.4.0.0 on android. Connection is running in a service. I need to completely disconnect from aSmack and stop the service,

I am doing :

mConnection.removeConnectionListener(mConnectionListener);

mConnection.disconnect();

mSmackAndroid.onDestroy();

mConnection = null;

And setting to null all used Managers/listeners/receivers

But after starting the service again I have very strange situation.

aSmack is connected, reads the roster, and in debug mode I see that it receives messages from server, but not delivering it to app. And also when I try to sent a message I have  ConnectionException.

But when I completely kill the app, then aSmack is correctly connected to server.

Outcomes