powered by Jive Software

Proper way to Terminate Smack Connection

When reporting issues include

  • The used Smack version
    implementation "org.igniterealtime.smack:smack-android-extensions:4.3.0"
    implementation "org.igniterealtime.smack:smack-experimental:4.3.4"
    implementation "org.igniterealtime.smack:smack-tcp:4.3.4"

Am having hard time to decide where in Android should I properly terminate the connection (with disconnect). The App class where my connection lives does not have onDestroy and so I don’t know where to do that (except when user clicks logout)

Does Smack have recommended place to disconnect to avoid any leaks?

Thanks!

I think it depends on what you want to achieve. Normally people want their (chat) app to stay connected even if the app is not opened. A method call to a shutdown method from the Application classes onDestroy() is not sufficient?

Running on background is a common case, but in my case, I want only to run when app is actually alive. If it dies then everything should die too

Do you mean Application have onDestroy? Never found any in my initial search. Only activities got that one. Let me re-check

I see your point, onDestroy called on the main activity (Hope you meant that one)
Thank you!

1 Like

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.