Skip to content
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

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

nrbrook
Copy link
Contributor

@nrbrook nrbrook commented Nov 5, 2021

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.

@CLAassistant
Copy link

CLAassistant commented Mar 1, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ nrbrook
❌ Akhunzaada
You have signed the CLA already but the status is still pending? Let us recheck it.

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
@nrbrook
Copy link
Contributor Author

nrbrook commented Mar 26, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants