powered by Jive Software

Android smack client disconnects after couple of minutes

I am using smack android SDK to develop my android chat application. Following SDKs are used to develop this chat app

org.igniterealtime.smack:smack-android-extensions:4.1.0-alpha6
org.igniterealtime.smack:smack-tcp:4.1.0-alpha6
org.igniterealtime.smack:smack-android:4.1.0-alpha6

I can successfully login to the chat and continue to chat with other users. However after couple of minutes of inactivity (5 - 10 mins) chat gets disconnected. Then

public void reconnectingIn(int seconds);

method in ConnectionListener get called continuously but in non of these reconnecting attempts client doesn’t get connected to the server.

Can anyone please shed some light to solve this issue?

Did you whitelist your app from Android’s battery optimizations?

You also use an old Alpha version of Smack 4.2, consider switching to RC1