Android-Service killed with “no longer want” - how to restart it?

前端 未结 2 856
执念已碎
执念已碎 2020-12-23 17:29

We have a Service that continuously collects sensor data on the phone. This service should run \"forever\", e.g. as long as the user wants, and not be killed by the system.<

2条回答
  •  庸人自扰
    2020-12-23 17:57

    How do you start the service? Have you tried startForeground()? That's not an absolute guarantee, of course, but should at least lengthen the lifespan.

提交回复
热议问题