Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何检查使用Google Play服务的Location API当前是否正在运行?_Android_Google Location Services - Fatal编程技术网

Android 如何检查使用Google Play服务的Location API当前是否正在运行?

Android 如何检查使用Google Play服务的Location API当前是否正在运行?,android,google-location-services,Android,Google Location Services,有没有办法知道location api服务是否正在运行。 如果没有运行,我需要重新启动定位服务 其目的是:当设备重新启动时,位置服务停止。当服务停止时,我需要再次启动它。您是如何集成位置api的?我是说你用过什么服务吗?如果可能,共享您的codeIntent intent=新意图(此,LocationService.class);pendingent=pendingent.getService(this,0,intent,pendingent.FLAG_UPDATE_CURRENT);Locat

有没有办法知道location api服务是否正在运行。 如果没有运行,我需要重新启动定位服务


其目的是:当设备重新启动时,位置服务停止。当服务停止时,我需要再次启动它。

您是如何集成位置api的?我是说你用过什么服务吗?如果可能,共享您的codeIntent intent=新意图(此,LocationService.class);pendingent=pendingent.getService(this,0,intent,pendingent.FLAG_UPDATE_CURRENT);LocationServices.FusedLocationApi.RequestLocationUpdate(mgoogleAppClient、mlLocationRequest、PendingEvent);您是否在服务中执行此操作并定期调用它?不,我正在我的主要活动中使用它,更新的位置将传递给intent service,intent service将根据我的共享首选项更新当前位置。所以我可以随时使用它。我也在寻找这个问题的答案。你是如何集成位置api的?我是说你用过什么服务吗?如果可能,共享您的codeIntent intent=新意图(此,LocationService.class);pendingent=pendingent.getService(this,0,intent,pendingent.FLAG_UPDATE_CURRENT);LocationServices.FusedLocationApi.RequestLocationUpdate(mgoogleAppClient、mlLocationRequest、PendingEvent);您是否在服务中执行此操作并定期调用它?不,我正在我的主要活动中使用它,更新的位置将传递给intent service,intent service将根据我的共享首选项更新当前位置。这样我就可以随时使用它。我也在寻找这个问题的答案。