Implemented scan permission checking on API 31#768
Open
nrbrook wants to merge 33 commits intodariuszseweryn:masterfrom
Open
Implemented scan permission checking on API 31#768nrbrook wants to merge 33 commits intodariuszseweryn:masterfrom
nrbrook wants to merge 33 commits intodariuszseweryn:masterfrom
Conversation
# Conflicts: # mockrxandroidble/build.gradle # rxandroidble/build.gradle # sample-kotlin/build.gradle # sample/build.gradle
Seems to work without now, and errors with
…oidBle into gradle-7-permissions
|
|
Get Recommended BLE Connect Runtime Permissions LocationServicesStatusApi31.isLocationPermissionOk() Always Returns True RxBleClient State Now Also Returns BLUETOOTH_PERMISSION_NOT_GRANTED BlePermissionException Class Added to Throw Missing BLUETOOTH_SCAN and BLUETOOTH_CONNECT Exceptions
2464147 to
808ad98
Compare
Contributor
Author
|
I decided to fork this project so we can maintain it more actively and merge the PRs we had open. I've forked at https://github.com/NRB-Tech/RxAndroidBle/ and it's on Maven Central as io.nrbtech.rxandroidble. I've merged this PR there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a work in progress to check the new permissions on API 31 before performing the operations that requires those permissions. Currently BLUETOOTH_SCAN is handled correctly, but BLUETOOTH_CONNECT is not. Because no connect permission was required before, it is more difficult to add the checks. I'm not very familiar with Dagger which makes things much more difficult to follow, so I've not been able to do that part, but I've added TODOs - BLUETOOTH_CONNECT is required for connection, but also apparently for getting bonded devices.
All the permission checking is done in
LocationServicesStatusApi31, which isn't really appropriate for the class name as they aren't related to location, but I didn't want to restructure everything.When scanning, it only checks for location permission if the manifest includes those permissions.
No tests are added yet as I'm not sure if I've implemented things in the correct way.