Reputation: 197
I follow this reference here and i wonder
2.Can I define the radius of beacon region such as 5 meters. Because now radius is too wide for my use case.
Upvotes: 1
Views: 1049
Reputation: 64916
In general this is possible, yes.
The RegionBootstrap
class is designed to auto launch your app into the background to scan for beacons, and send callbacks whenever you enter/exit a beacon region. Because the operating system may kill your app to save memory, the library is designed to re-launch the app so its background scanning service can continue operating under a few conditions:
AlarmManager
.Following the reference you mention, this behavior should be automatic.
While you can't define a radius of a Region
, you can add filtering logic that does something similar. Once you get a callback to didEnterRegion
, start ranging for beacons in that region. In the ranging callback, if you see that beacon.getDistance() < 5.0
you can execute your logic that you want to happen only if the beacon is less than five meters away.
Upvotes: 2