How can I prevent my Android app/service from being “killed” from a task manager?

后端 未结 6 437
你的背包
你的背包 2020-12-13 07:24

It is very important that my service stay running until someone with a password stops the service from my UI screen. My app runs great but it is designed to be turned on/off

6条回答
  •  萌比男神i
    2020-12-13 07:45

    There isn't a way to prevent this directly, without a rooted device. The SDK helpfully prevents these kinds of issues.

    You can do the "truly evil" trick and have two services in two application. Each service monitors the other, and restarts it if it stops. This is kludgy, but in most cases even the fastest fingered kid couldn't kill both applications.

提交回复
热议问题