Understanding distance

When we range beacons using the locationManager:didRangeBeacons:inRegion method of CLLocationManager, we're given a collection of beacons (CLBeacon). In order to understand the distance of the beacon from our device, the CLBeacon class gives us two properties:

  • proximity: The proximity property gives you the distance from the device using the CLProximity enum, giving one of four values CLProximityUnknown, CLProximityFar, CLProximityNear, and CLProximityImmediate.
  • accuracy: The accuracy property gives you the distance from the device as a double value, which is the distance measured in meters. If the distance cannot be determined, the value is returned as negative.

The CLProximity enum values represent the approximate distance ...

Get Learning iBeacon now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.