Do something when app closed in android

1.2k views Asked by At

when user exit the android app in the normal way (No Hard Exit like Force Close) i want the app to do something

im working on some kind of chat app and i want the app to update user status make it offline when the user close the app.

i try few solutions but nothing worked.

1

There are 1 answers

0
Jim On

You will need to implement a Service and then bind your Activity to the service so that it is aware of the Activity's state.

http://www.vogella.com/tutorials/AndroidServices/article.html