需要在Android 10.0上启用蓝牙低功耗扫描的位置 [英] Location needs to be enabled for Bluetooth Low Energy Scanning on Android 10.0

查看:132
本文介绍了需要在Android 10.0上启用蓝牙低功耗扫描的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将我的Pixel XL升级到Android 10.0版后,仅当我打开位置信息"功能后,蓝牙低功耗(BLE)扫描才能工作.

After upgrading my Pixel XL to Android version 10.0 Bluetooth Low Energy (BLE) scanning will only work if i have Location turned on.

到目前为止,这一直不是问题,它可以在运行Android 9.0、8.0和6.0.1的多个设备上运行.

This has not been an issue until now and it's working on multiple devices running on Android 9.0, 8.0 and 6.0.1.

我的应用仅使用 BluetoothLeScanner 在前台进行扫描 startScan(List< ScanFilter>过滤器,ScanSettings设置,ScanCallback回调)

My app is only scanning in foreground using BluetoothLeScanner startScan(List<ScanFilter> filters, ScanSettings settings, ScanCallback callback)

我的应用程序具有FINE_LOCATION,COARSE_LOCATION和BLUETOOTH权限,我尝试添加ACCESS_BACKGROUND_LOCATION权限,但是没有运气.

My app has FINE_LOCATION, COARSE_LOCATION and BLUETOOTH permissions, I've tried adding ACCESS_BACKGROUND_LOCATION permission but had no luck.

Android 10.0中对应用程序扫描蓝牙设备是否有更严格的要求,我对此一无所知,希望我不必要求用户打开位置"即可使我的应用程序正常工作.

Are there stricter requirements in Android 10.0 for apps to scan for Bluetooth devices, i can't find anything about this and am hoping i don't have to ask users to turn on Location for my app to work.

推荐答案

从Android 10开始,现在需要打开ACCESS_FINE_LOCATION才能执行蓝牙操作.这样做的原因是可以使用蓝牙来收集有关用户位置的信息(例如使用BLE信标),并且应该声明相关的应用程序许可.

As of Android 10, it is now required to have ACCESS_FINE_LOCATION turned on in order to perform Bluetooth operations. The reason for this is that Bluetooth can be used to gather information about the location of the user (e.g. using BLE beacons), and for that the relevant app permission should be declared.

对于Android 9及更低版本,ACCESS_COARSE_LOCATION就足够了,这可能就是您的应用正常运行的原因.

For Android 9 and lower, ACCESS_COARSE_LOCATION is sufficient which is probably why your app was working without an issue.

更多信息可以在这里找到:-

More information can be found here:-

我希望这会有所帮助.

这篇关于需要在Android 10.0上启用蓝牙低功耗扫描的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆