-
Notifications
You must be signed in to change notification settings - Fork 583
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
Implemented scan permission checking on API 31 #768
base: master
Are you sure you want to change the base?
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
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 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.