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

Android 12 Changes #1043

Merged
merged 3 commits into from
Aug 8, 2021
Merged

Android 12 Changes #1043

merged 3 commits into from
Aug 8, 2021

Conversation

davidgyoung
Copy link
Member

@davidgyoung davidgyoung commented Aug 1, 2021

This builds on #1040 by @nbadal to make a number of changes required to use the library with Android 12:

  • All internal PendingIntents must specify FLAG_IMMUTABLE.
  • All internal services and broadcast receivers in the library's Manifest must declare android:exported="false"
  • The library's automatic reading of the remote device's Bluetooth name must catch a SecurityException to prevent a crash in the case that the app does not have Manifest.permission.BLUETOOTH_CONNECT permission

Notes on permissions:

This change does not add any permissions to the library's manifest, as it is unclear what is needed in the final version of Android 12. Some of this may end up being documentation changes rather than library internal changes.

  1. In my tests with Android 12 Build Number SPB3.210618.013, I was unable to get scans to start without throwing a SecurityException (caught internally by the library) unless android.permission.BLUETOOTH_SCAN was in the app manifest and granted at runtime by the user in addition to android.permission.FINE_LOCATION. This seems contrary to the Android 12 documentation posted of August 12, 2021 here that suggests only one of the two is necessary. I am hoping this behavior will change in a subsequent beta release of Android 12. But for now, apps targeting API 31 must declare both permissions in the manifest and request both from the user at runtime.

  2. In order to for Beacon#bluetoothName to be populated in Android 12, the app must declare and obtain Manifest.permission.BLUETOOTH_CONNECT from the user at runtime.

  3. While I have not tested this, android.permission.BLUETOOTH_ADVERTISE is presumably needed for using BeaconTransmitter. I am not sure if the app will crash or if the transmission will fail silently without this permission.

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.

2 participants