What is the exact difference between didEnterRegion and didRangeBeacons in terms of use case i mean when i should implement didEnterRegion/didExitRegion and when should i implement didRangeBeacons ?
What are the each delegate method's exact functionality ? From apple's documentation it's not very clear.
- (void)locationManager:(CLLocationManager *)manager
didEnterRegion:(CLRegion *)region
{
}
AND
- (void)locationManager:(CLLocationManager *)manager
didRangeBeacons:(NSArray *)beacons
inRegion:(CLBeaconRegion *)region
{
}
didEnterRegion
will be called once when you cross the threshold of the region (i.e. detect the beacon). Once you exit the region (i.e. the beacon is no longer visible) didExitRegion
will be called and then didEnterRegion
will be called again if you re-enter the region.
didRangeBeacons
is called repeatedly while beacons that you are ranging are visible, giving you updated proximity information.
A common strategy is to monitor for beacon regions and once didEnterRegion
is called, start ranging that beacon for updates, stopping the ranging once didExitRegion
is called.
See also - The Location Programming Guide
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With