views:

202

answers:

1

I am developing an application that needs to constantly run a service unless the user consciously deactivates it. The problem is that there are taskkiller-apps with a "kill all applications"-button. These seem to become increasingly popular, and they are causing me a fuzz. When I kill my service with som task managers, onDestroy() is never run and all AlarmManagers are killed with the service. Is there any way to protect my service from these apps, or to restart my service immediately after it is killed?

+6  A: 

Is there any way to protect my service from these apps, or to restart my service immediately after it is killed?

Not really, sorry.

Besides, if your service is well-behaved (i.e., not designed to run in memory all of the time), users will be less likely to kill it off using these tools. Services are not designed to run forever.

CommonsWare
Thanks for that link, its very good reading
Donal Rafferty
Thanks for a great answer. Unfortunately more and more task managers are adding the "kill all"-button to make it easier for users to free up memory, so users might kill my service by mistake. My current solution is to have a constant notification that shows when the service is running (this can ofcourse be turned off in the settings-menu). Hopefylly then the user will detect if the notification disappears.
sandis
Yeah sorry this is unfortunate. Froyo will address the issue, but I realize it will be a while before this will generally help developers.
hackbod