iBeacon ranging and background issues

When coming to iBeacon development, it’s just a matter of time until you’ll get to the point when you’re in need to determine wether your Immediately at, Near to or Far away from that neat little Beacon.

Thank Apple there’s an API for that in CLLocationManagerDelegate which is called locationManager:didRangeBeacons:inRegion:.

Unfortunately this API does not belong to all the other APIs designate for use in Background Mode. After triggering the locationManager:didEnterRegion: method, ranging will start for about 5 seconds an then quit silently. That’s not what we want nor need when trying to successfully determine the user’s distance to the iBeacon.

There are lots of discussion about this behavior and over at Stackoverflow, at the point of writing this, I decided to not integrate any further mechanism to let the user decide at which distance the iBeacon triggers it’s events because you can never ensure that it will trigger them as you’ve got very limited time (about 5secs.).

Hopefully there’ll be an alternative for that in the future.