Android: How to know activity/service killed by advanced task killer?
I just want to know how detect that the activit开发者_如何学JAVAy or service has been killed by the advanced task killer? I was expecting the onDestroy method to be called, but it doesnt!
My app starts the background service on boot. The activity is not started except from menu. But its name appears in the advanced task killer list. When I try to kill it, it doesnt call the onDestroy method neither the service's.
Any ideas?
Thanks in advance.
I just want to know how detect that the activity or service has been killed by the advanced task killer?
You do not receive any notification when your task is killed in this fashion.
I was expecting the onDestroy method to be called, but it doesnt!
There are various scenarios in which onDestroy()
of an activity or service will not be called. This is one of them.
My app starts the background service on boot.
I sincerely hope that service shuts down in a few seconds. Otherwise, please consider whether what you are doing is the right thing.
精彩评论