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.
Two new features:
Adds new methods to start beacon ranging and monitoring that allows forgoing manual calls to
bind(...)
andunbind(...)
and the use ofBeaconConsumer
. This simplifies setup.beaconManager.startMonitoring(@NonNull Region region)
beaconManager.stopMonitoring(@NonNull Region region)
beaconManager.startRangingBeacons(@NonNull Region region)
beaconManager.stopRangingBeacons(@NonNull Region region)
The old methods that do require a manual call to bind and a
BeaconConsumer
first still work:beaconManager.startMonitoringBeaconsInRegion(@NonNull Region region)
beaconManager.stopMonitoringBeaconsInRegion(@NonNull Region region)
beaconManager.startRangingBeaconsInRegion(@NonNull Region region)
beaconManager.stopRangingBeaconsInRegion(@NonNull Region region)
beaconManager.getBeaconParsers().add(BeaconParser().setBeaconLayout("s:0-15=2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6,m:16-17=A6FF,p:18-18,i:0-15l"))
In the example above, a beacon with service UUID 2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 will be matched if the service data has the first two bytes 0xA6 0xFF. A single identifier will be parsed out of the beacon which will always be the same as the service UUID. This is useful for treating service advertisements as beacons for some use cases.
This change is available for testing in 2.19-beta5