Bluetooth Permissions
Native Android ==> Bluetooth module
The validicmobile-ble artifact automatically adds the following permissions to the consuming application's mergedAndroidManifest.xml:
<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:permissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" android:maxSdkVersion="30"/>
Android 10
Starting with Android 10, android.permission.ACCESS_FINE_LOCATION is required by the OS.
android.permission.ACCESS_BACKGROUND_LOCATION must be requested along with android.permission.ACCESS_FINE_LOCATION in order for Passive Bluetooth reading to succeed if the device is in DOZE mode for devices running api 26 or later
Android 11
Starting with Android 11, on devices running api >= Android 11 (api 30), the android.permission.ACCESS_BACKGROUND_LOCATION must be granted manually by end user's in the application settings. To navigate to the application settings use the following code
Intent intent = new Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.parse("package:" + getApplication().getPackageName())
);
intent.addCategory(Intent.CATEGORY_DEFAULT);
startActivityForResult(intent, BLE_BACKGROUND_CODE);
Android 12
Starting with Android 12 there are new permissions that must be requested at runtime. BLUETOOTH_SCAN
, and BLUETOOTH_CONNECT
. For devices running Android 12 or higher the ACCESS_FINE_LOCATION
and ACCESS_BACKGROUND_LOCATION
permissions are no longer required. They are still required for devices running Android 11 or below.
Updated 4 days ago