首页 > 解决方案 > 谷歌地图是否重叠 locationListener 方法?

问题描述

我在我的项目 mainActivity 上使用谷歌地图。我也需要在后台获取位置,因此创建了一个包含 locationListener 的服务。它在启用/禁用提供程序但不更新位置时正常工作。谷歌地图可能会导致这种情况吗?

标签: androidgoogle-mapsbroadcastreceiverandroid-service

解决方案


我觉得您可能正在与有关对 android O ( https://developer.android.com/about/versions/oreo/background-location-limits ) 的后台位置更新施加的限制问题作斗争。您可以考虑调用前​​台服务。有关如何在前台服务中使用位置记录的指南,这里是我之前编写的一些代码(https://github.com/kris-geyer/pegLog


推荐阅读