-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request location permissions for BLE scan on Android 12 and older #126
base: develop
Are you sure you want to change the base?
Conversation
Release 0.18.0
Add the missing 'contacts' permission to README.md
I have not tested permission for BLE connect yet, expect an additional PR if changes are needed there as well. |
private fun allBluetoothPermissions() = buildSet { | ||
addAll(bluetoothConnectCompat()) | ||
addAll(bluetoothScanCompat()) | ||
addAll(bluetoothAdvertiseCompat()) | ||
}.toList() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seemed more maintainable (don't need to keep "all" aligned with the other specific permission types, at the expense of allocating a Set
), let me know if you'd prefer me to use the static lists (as it was before).
Tested the Tested with:
Note All devices tested immediately grant permission (without showing dialog) when requesting |
Attempted to use
moko-permissions
on an Android 11 device (Pixel 2 XL) and found that after granting permissions, scanning would silently not deliver any advertisements. Determined that the problem was missing location permission.Per Bluetooth permissions documentation, the following permissions are needed for Bluetooth Low Energy scanning (summarized in table form for readability):
VANILLA_ICE_CREAM
BLUETOOTH_SCAN
UPSIDE_DOWN_CAKE
BLUETOOTH_SCAN
TIRAMISU
BLUETOOTH_SCAN
S_V2
BLUETOOTH_SCAN
S
BLUETOOTH_SCAN
R
ACCESS_FINE_LOCATION
Q
ACCESS_FINE_LOCATION
P
ACCESS_COARSE_LOCATION
O_MR1
ACCESS_COARSE_LOCATION
O
ACCESS_COARSE_LOCATION
N_MR1
ACCESS_COARSE_LOCATION
N
ACCESS_COARSE_LOCATION
M
ACCESS_COARSE_LOCATION
LOLLIPOP_MR1
ACCESS_COARSE_LOCATION
LOLLIPOP
,L
ACCESS_COARSE_LOCATION
Tested these changes as working on:
BLUETOOTH_SCAN
ACCESS_FINE_LOCATION
ACCESS_COARSE_LOCATION