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 builds on #1040 by @nbadal to make a number of changes required to use the library with Android 12:
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.
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 toandroid.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.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.While I have not tested this,
android.permission.BLUETOOTH_ADVERTISE
is presumably needed for usingBeaconTransmitter
. I am not sure if the app will crash or if the transmission will fail silently without this permission.