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

WIP: Support API 31 (Android 12) new Bluetooth permissions #762

Merged
merged 12 commits into from
Oct 6, 2021

Conversation

dariuszseweryn
Copy link
Owner

@dariuszseweryn dariuszseweryn commented Jul 30, 2021

API 31 introduces new Bluetooth permissions required for BLE operations. In the context of RxAndroidBle the important ones are:

  • BLUETOOTH_SCAN — replaces previously needed ACCESS_FINE_LOCATION
  • BLUETOOTH_CONNECT — a new concept

Considerations:
The library's AndroidManifest.xml does include ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION since API 23. Technically these could be restricted to maxSdkVersion="30" but it could be a breaking change for apps that require location access otherwise. There is a new example in the Readme if the user does not want to require location access for other reasons than scanning BLE peripherals.

TODO:

  • Check if having BLUETOOTH_SCAN makes Location Services requirement obsolete
    Result: If the user sets flag neverForLocation then Location Services are not needed. Otherwise they still are needed to get scan results.
  • Adjust the code to conform to new requirements for Location Services
  • Add check for new BLUETOOTH_CONNECT permission? Expected to be a thrown exception anyway
  • Design new RxBleClient#State API for convenient usage with the new permission model Extracted to Create new API for getting state of RxBleClient #764

Resolves #752

@b055man
Copy link

b055man commented Sep 6, 2021

Hi @dariuszseweryn,

thanks for working on this!
Is there any ETA for publishing this change? Better yet, any chance for getting a new version of multiplatform_ble_adapter + flutter_ble_lib once that change is merged.. ? :)

@dariuszseweryn
Copy link
Owner Author

Hi, I was on long vacations. I am trying to maintain only the RxAndroidBle. Other mentioned libs were transferred to a different entity...

@dariuszseweryn dariuszseweryn marked this pull request as ready for review October 6, 2021 19:05
@dariuszseweryn dariuszseweryn changed the base branch from master to develop October 6, 2021 19:16
@dariuszseweryn dariuszseweryn merged commit f6e3d06 into develop Oct 6, 2021
@dariuszseweryn dariuszseweryn deleted the feature/android_12_permissions branch October 6, 2021 19:22
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.

Support Android 12 Bluetooth Permissions
2 participants