According to the documentation, we can remove the location permissions for bluetooth if we're targeting Android 12. The problem is that I'm not sure about this, because this would mean that Android 11 or lower doesn't require ANY runtime permissions when using bluetooth. Since the new permissions can only be used in Android 12, like this:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
when {
hasBluetoothPermissions() -> startScanning()
shouldShowRequestPermissionRationale(Manifest.permission.BLUETOOTH_SCAN) ||
shouldShowRequestPermissionRationale(Manifest.permission.BLUETOOTH_CONNECT) -> {
showDialog()
}
else -> requestPermissionLauncher.launch(
arrayOf(
Manifest.permission.BLUETOOTH_SCAN,
Manifest.permission.BLUETOOTH_CONNECT
)
)
}
} else {
startScanning()
}
Would this work for Android 11 or lower, while having no location permissions in the manifest? I'm using these permissions:
<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_SCAN"
android:usesPermissionFlags="neverForLocation"
tools:targetApi="s" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />