Request only the Bluetooth permission the app actually uses

Lint flagged ACCESS_FINE_LOCATION declared without ACCESS_COARSE_LOCATION,
which Android 12 requires to be requested together.

Rather than add the missing one, drop location entirely: the Bluetooth
transport only talks to already-paired devices, enumerating bonded
devices and opening an RFCOMM socket. Neither is a scan, so no location
access is needed. BLUETOOTH_SCAN and BLUETOOTH_ADVERTISE go for the same
reason — nothing was using them.

Discovery of unpaired devices would bring all of these back; the manifest
notes what that would require.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015qjfMiPUDshdKEUa6vxqzN
This commit is contained in:
Claude
2026-08-05 22:56:27 +00:00
parent 4ad0f52331
commit 85ec10836b
2 changed files with 13 additions and 20 deletions
@@ -47,14 +47,10 @@ class MainActivity : ComponentActivity() {
}
private fun requestBluetoothPermissions() {
// Only CONNECT: the transport reaches paired devices and never scans.
// See the manifest for what discovery of unpaired devices would add.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
bluetoothPermissions.launch(
arrayOf(
Manifest.permission.BLUETOOTH_CONNECT,
Manifest.permission.BLUETOOTH_SCAN,
Manifest.permission.BLUETOOTH_ADVERTISE,
)
)
bluetoothPermissions.launch(arrayOf(Manifest.permission.BLUETOOTH_CONNECT))
}
}