19
votes

I am working on an app that is connected to the BLE device using BluetoothGatt.

I am successfully able to scan and connect with BLE devices in all devices like Samsung, Pixel, etc. I followed Android official BLE connection guide for scanning and connection.

But after updating my Pixel 2 to Android 10, I am not able to connect my BLE device to Pixel 2. I also, seen the same issue was reported in Google issue tracker.

To fix this I tried clear Bluetooth app cache and Network reset but It works in some devices but not all.

Is there anything that needs to be done to fix this issue or is there a proper way to clear Bluetooth app cache and Network reset programmatically.

Or any other way to manage BLE connection in Android?

1
Is it the scanning or the connecting that doesn't work? Any error/status codes? Logcat messages?Emil
The connection doesn't work. I am not to get logcat because of this happen on customer's devices.Sanjay Kakadiya
I have the same problem but it only occurs when two devices from same company are paired, I can't connect to any of them. After unpairing second one connection is fine.M Tomczyński
Are you using bonding? Is the device broadcasting publicly or privately?M Tomczyński
I have the same problem. I am using the BleScanner and it is not detecting advertisements. If I build the app using 28 it DOES work even on Android 10, but if I build using 29 it does NOT work. Exact same code.Brian Reinhold

1 Answers

2
votes

On Android 10 (API 29), permissions changed and now require ACCESS_FINE_LOCATION for BLE scanning if it is your compilation target.

However, if you've compiled against API 28, and have ACCESS_COARSE_LOCATION, it should continue to work on Android 10.

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

See the following as this question may be a potential duplicate: Android 10 not working with BLE Bluetooth scanning