Android 10 BLE连接问题

San*_*iya 11 android bluetooth bluetooth-lowenergy bluetooth-gatt android-10.0

我正在使用连接到BLE设备的应用程序BluetoothGatt

我能够成功扫描并连接所有设备(如Samsung,Pixel等)中的BLE设备。我遵循了Android官方BLE连接指南进行扫描和连接。

但是将其更新Pixel 2为后Android 10,我无法将BLE设备连接到Pixel2。我也看到Google问题跟踪器报告了相同的问题。

为了解决这个问题,我尝试清除蓝牙应用程序缓存和网络重置,但是它可以在某些设备上运行,但不能在所有设备上运行。

是否需要做任何事情来解决此问题,或者是否有适当的方法以编程方式清除Bluetooth应用程序缓存和网络重置。

或以其他任何方式在Android中管理BLE连接?

Zac*_*sky 2

在 Android 10 (API 29) 上,权限已更改,现在需要 ACCESS_FINE_LOCATION 才能进行 BLE 扫描(如果它是您的编译目标)。

但是,如果您已针对 API 28 进行编译,并且具有 ACCESS_COARSE_LOCATION,则它应该可以继续在 Android 10 上运行。

源: https://developer.android.com/about/versions/10/privacy/changes#location-telephony-bluetooth-wifi

请参阅以下内容,因为此问题可能可能重复: Android 10 notworking with BLE Bluetooth Scanning