android - Android Q 中引入的 ACCESS_BACKGROUND_LOCATION 如何影响 Geofence API?

标签 android android-location android-geofence android-10.0

为了使用地理围栏 API,用户 has to give应用ACCESS_FINE_LOCATION。该位置被认为是危险的,可以随时撤销;一旦撤销此权限,应用程序将无法请求地理围栏更新。

ACCESS_BACKGROUND_LOCATION 权限如何适合这张图片?我们确信这个权限也是dangerouscan be revoked at any time 。这是否意味着,如果我们想要注册一些 IntentService 以在每次发生地理围栏更改时调用,我们还必须确保用户已提供 ACCESS_BACKGROUND_LOCATION 权限?或者,如果我们尝试在自己的后台 Service/BroadcastReceiver 中获取当前位置,我们是否需要使用此权限?

我问这个问题的原因是文档此时似乎有点模糊:描述 Q Developer Preview 的文档提到地理围栏是后台位置检索的用例之一,而 Geofencing API page其要求中未提及 ACCESS_BACKGROUND_LOCATION

最佳答案

Geofencing API Documentation现已更新,如果我们面向 Android Q,我们需要定义 ACCESS_BACKGROUND_LOCATION 来监控地理围栏

来自文档:

To use geofencing, your app must request ACCESS_FINE_LOCATION. If your app targets Android 10 (API level 29) or higher, your app must also request ACCESS_BACKGROUND_LOCATION.

关于android - Android Q 中引入的 ACCESS_BACKGROUND_LOCATION 如何影响 Geofence API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55705238/

相关文章:

java - 使用线程删除位置更新

android - ACCESS_COARSE_LOCATION 权限可在 Android 上提供手机信号塔精度

Android Maps Spherical Util Distance

java - 使用两个 android 应用程序的地理围栏

android - java.lang.NoSuchFieldError : Sometimes 错误

java - ListView - CHOICE_MODE_MULTIPLE_MODAL - 正在选择随机项目

Android禁用锁屏应用程序的所有硬件键

android - 如果我使用 Google Play 服务,用户是否需要登录 Google Play?

android - 无法从 PendingIntent 触发地理围栏转换 IntentService

android - Android 设备是否需要通过 USB 供电才能支持自定义 USB 配件?