Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 10 BLE connection issue

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?

like image 968
Sanjay Kakadiya Avatar asked Oct 09 '19 07:10

Sanjay Kakadiya


1 Answers

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

like image 174
Zachary Moshansky Avatar answered Oct 01 '22 14:10

Zachary Moshansky