android - Life cycle of the application: How to do some clean jobs when the process is terminated? -


my application straightforward, main activity -> activity 1 -> activity 2, , there worker thread doing downloading jobs. , started within same process.

i want downloading thread not terminated until activities destroyed, or @ end of process. in java, simple: ok adding clean code in main method. don't know right way in android. because every activity possible recycled system, don't know put clean code of worker thread, , dont't know end point of total application.

could give me ideas? thanks.

not sure if helps, can start service in main activity , have clean code in service's ondestroy method. service destroyed when application destroyed

onterminate works on emulator - stated in docs.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -