【问题标题】:Beacon detection stops when giving ACCESS_FINE_LOCATION permission in Marshmallow在 Marshmallow 中授予 ACCESS_FINE_LOCATION 权限时,信标检测停止
【发布时间】:2015-11-26 15:24:11
【问题描述】:

我在BaseApplication 类中设置了信标背景扫描using this tutorial,但在Marshmallow 运行设备中显示此日志:

Caught a RuntimeException from the binder stub implementation.
java.lang.SecurityException: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results

最后,通过thisthis 参考,我能够为 Marshmallow 运行设备提供位置访问权限以检测信标。

我的问题:

即使我授予位置访问权限,它也不会检测到信标,并且也会停止显示日志上方。这是ISSUE 中的问题吗?我的 Nexus 5 内部版本号是 MRA58N

更新:当我手动打开位置时,它现在可以工作了。但这很奇怪。检测信标是否正确?

【问题讨论】:

    标签: android android-6.0-marshmallow altbeacon beacon


    【解决方案1】:

    Android Marshmallow 引入了全新的应用程序权限,用户现在可以随时撤销运行时权限。这意味着您不能假设应用程序有权访问该权限,即使之前已授予该权限。您可以参考this libthis guide。并且您可以创建一个接口侦听器位置在启用 GPS 后更改,当位置!= 0 时。启用 GPS 后,您必须恢复。我希望这会帮助你。

    【讨论】:

      猜你喜欢
      • 2011-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-01
      • 1970-01-01
      • 2015-08-13
      • 1970-01-01
      相关资源
      最近更新 更多