Request location permissions for BLE scan on Android 12 and older #126
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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