Location needs to be enabled for Bluetooth Low Energy Scanning on Android 10.0

Viewed 3434

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

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.

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

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

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.

2 Answers

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.

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:-

I hope this helps.

on android 10 ask these three permission

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>

declare in manifest and also ask at runtime

Related