Android Permissions
Android requires additional permissions declared in the manifest for an app to run a BLE scan since API 23 (6.0 / Marshmallow) and perform a Bluetooth Low Energy connection since API 31 (Android 12). These permissions currently assume scanning is only used when the App is in the foreground, and that the App wants to derive the user's location from Bluetooth Low Energy signal (on API >= 23). Below are a number of additions you can make to your AndroidManifext.xml
for your specific use case.
Location permission for Bluetooth Low Energy Scanning
Bridgefy uses the uses-permission-sdk-23
tag to require location only on APIs >= 23, you can request the required permissions by adding the following to your AndroidManifest.xml
:
Scan in the background and support APIs 29 & 32
You should add the following to your AndroidManifest.xml
:
If you want to access the user's location in the background on APIs > 30, remove the android:maxSdkVersion
attribute.
Location from BLE scanning in API >= 31
API 31 (Android 12) introduced new Bluetooth permissions. Bridgefy uses the android:usesPermissionFlags="neverForLocation"
attribute on the BLUETOOTH_SCAN
permission, which indicates scanning will not be used to derive the user's location, so location permissions are not required. If you need to locate the user with BLE scanning, use this instead, but keep in mind that you will still need ACCESS_FINE_LOCATION
:
Connect peripherals
You add the BLUETOOTH_CONNECT
permission that Bridgefy requests in APIs >= 31:
Summary of available permissions
Required permissions
A summary of available runtime permissions used for BLE:
Needed if scan is performed in background
Last updated