this question has answer here:
- how keep running service whole time? 5 answers
the service
in android killed if resources of device not enough.how can make daemon or service live forever , never exit?
a started service can use startforeground(int, notification) api put service in foreground state, system considers user actively aware of , not candidate killing when low on memory. (it still theoretically possible service killed under extreme memory pressure current foreground application, in practice should not concern.)