安卓:服务自动重启自动重启

2023-09-07 18:09:44 作者:屏住呼吸,所有的氧气只为

我正在与这节省了服务的 GPS经纬度的 continiously

I'm working with a service which saves GPS latlng's continiously

但是很多时候该服务是越来越自动重新启动,这导致数据的丢失...

But many times the service is getting restarted automatically, which results in data loss...

那么,有没有办法,我们可以重新启动限制的服务。或任何想法来清除这个问题。

so is there any way that we can restrict the service from restarting. or any idea to clear this issue.

推荐答案

您可以通过提到它在清单文件

You can create a new process for the service by mentioning it in the Manifest file as

android:process=":newservice"

里面的服务标签

Inside the service tag