Can a service be killed by a task killer
I am writing an auto speaker app that has a service inside and listen for a phone state change.
I expect the service to exist all the time and cannot be killed.
However, I found that if I use a task killer to kill my application, there will be a few seconds when my listener will not work.
Although my app seems to restart automatically after a few seconds and work again.
Why can a service be killed by a task killer?
Is the service the same as an activity, no UI and can restart automatically?
Thanks for your reply.
source to share
You cannot free your service from being terminated by the user or automatically by the OS when resources are needed.
The best thing you can do is try to write code to compensate for the restarts, but of course not write as if your service was running without exception.
EDIT
The Android developer documentation Service Lifecycle Management contains useful information on recovering from stops and when calls are called and not.
source to share