I am developing a hybrid application. I had used a plugin for track the location continuously using background service.
My problem is if I didn't use my application 2 days. The process is getting killed by itself. The status is changed to 0 process 1 service running. So cannot get location updates.
So how to resolve my issue? The below link is my location tracking plugin code for cordova.
答案 0 :(得分:0)
Android只要需要清除内存就会终止服务。您可以在服务中使用START_STICKY,但这并不能100%确保您的服务在被杀后再次启动。我建议使用AlarmManager检查服务是否正在运行,如果不是,请重新启动该服务。