I develop an application with several activities.
When the application starts, it goes into InitActivity and it makes some initializations.
For example, it starts a thread that sends periodically a network request toward a server (keep-alive mechanism).
My problem is "how to process operations before exiting the application ?" (typically, to stop the keep-alive thread).
My idea is to make a forward to an ExitActivity before exiting.
It would be easy if I had only one activity in my app. I would use onCreate() and onDestroy() methods to process init and end operations.
I manage to handle BACK Key press (using onKeyDown() method in the activities) but I don't manage to catch the HOME key...
Do you know how to execute code just before exiting the application ?
Thanks for you help !