简体   繁体   English

位置跟踪、打瞌睡、AppStandby

[英]Location Tracking, Doze, AppStandby

I've implemented Background Location Tracking using IntentService.我已经使用 IntentService 实现了后台位置跟踪。 I'm able to receive Location points in Foreground Mode.我可以在前台模式下接收位置点。 But when a device is locked or after some time app killed, I'm not able to receive location points.但是当设备被锁定或一段时间后应用程序被杀死时,我无法接收位置点。 How can I handle Doze & AppStandby while tracking the location of a device in the background?如何在后台跟踪设备位置的同时处理 Doze 和 AppStandby?

I don't want to run foreground service all the time.我不想一直运行前台服务。 Any solution for Background Continuous Location Tracking with handling Doze and AppStandby?有处理 Doze 和 AppStandby 的后台连续位置跟踪解决方案吗?

You can implement custom locationlistener or FusedLocationProviderApi ( fused link ) as per fused documentation您可以根据融合文档实现自定义位置侦听器或 FusedLocationProviderApi( 融合链接

The fused location provider manages the underlying location technologies, such as GPS and Wi-Fi.融合位置提供程序管理底层定位技术,例如 GPS 和 Wi-Fi。

I implemented the scenario that's not approximately same to yours but in that I had condition to pick targeted location if internet is not available so, i implemented my own Listener that you can find from ( here ) which is connected to the Bind Service.我实现的场景与您的场景不大致相同,但如果互联网不可用,我有条件选择目标位置,因此,我实现了我自己的监听器,您可以从( 此处)找到它连接到绑定服务。

You also have to implement the location listener with the use of background service.您还必须使用后台服务来实现位置侦听器。 and for the doze you can programmatically turn it off for this app procedure .对于打瞌睡,您可以为此应用程序以编程方式将其关闭。

If you are using fusedLocationClient API as given in this link then i request you to change your dependencies use Google play services as they provide more feasible and accurate location than fusedLocation API's by android.如果您正在使用此链接中给出的 fusedLocationClient API,那么我请求您使用 Google Play 服务更改您的依赖项,因为它们提供比 Android 的 fusedLocation API 更可行和更准确的位置。 you can refer the documentation Here and also they provide a solution for your problem using background location tracking您可以参考此处的文档,他们还使用后台位置跟踪为您的问题提供了解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM