简体   繁体   中英

Protect my service from taskkiller-apps

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?

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 (ie, 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 .

I ran into a similar problem, using "Advanced Task Manager" for Android. The app even has an "exlude list" where you can protect your apps from being killed by the Task Manager.
But still, my service would be killed, leaving it useless. I've been through loads of forums, trying to contact the author of ATM, but to no avail.

The solution (sounds like a bug in ATM): I had to exclude the service as well as the app that started the service in ATM to make it leave my app untouched (even though only the service was needed). Weird, but true.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM