As you know like samsung, htc have a custom task manager menu like below. This menu can be popup up long press the home button. If my application is working in background and if i close it from Task Manager, i can not handle it. Activity onDestroy method is not invoked.
Asked
Active
Viewed 3,690 times
1 Answers
3
Unfortunately there isn't a good answer for handling this situation. If the app is force-killed, onDestroy method isn't necessarily called. According to the documentation
Note: do not count on this method being called as a place for saving data! For example, if an activity is editing data in a content provider, those edits should be committed in either onPause() or onSaveInstanceState(Bundle), not here.
If you can, clean up in the onPause() method. In order for the user to get to that screen to kill the app, it has to have been backgrounded and thus onPause() would be called. (see documentation)
It looks like you're in a similar situation as the question being asked in another SO thread - https://stackoverflow.com/a/3856300/413254
-
is there any documentation to confirm it, because i have to convince my customer – Winston Jul 31 '13 at 14:05
-
Updated my response with a link to the documentation. – loeschg Jul 31 '13 at 14:08