I've been developing an iOS app and playing around with Apple's CoreLocation
and iBeacon
technology. So far I used three beacons with different UUIDs. Everything was ok until I decided to add more beacons to my app. Only then I ran into strange issue. It's been said, a single app can monitor up to 20 beacon regions at once, when in the background - however in my particular case, this number seems to be 3. I tried different approaches, nothing worked. When I shuffled beacons in their array the outcome was as I expected - only the first 3 beacon regions triggered didEnterRegion
and didExitRegion
events when app was in background. This didn't applied when it was in foreground.
Please consider this:
For each custom beacon object I create an instance of CLBeaconRegion
like so:
let beaconRegion = CLBeaconRegion(proximityUUID: NSUUID(UUIDString: region.uuid)!, identifier: region.uuid)
beaconRegion.notifyOnEntry = true
beaconRegion.notifyOnExit = true
beaconRegion.notifyEntryStateOnDisplay = true
Then I pass that instance to CLLocationManager's startMonitoringForRegion
method like so:
locationManager.startMonitoringForRegion(beaconRegion)
When looping through CLLocationManager's monitoredRegions
method response I get all the beacon regions I expected with regionState 2 (outside)
On top of that I've already added:
NSLocationAlwaysUsageDescription
to app's Info.plist
locationManager.requestAlwaysAuthorization()
to ViewController's viewDidLoad method
Still, didEnterRegion
and didExitRegion
trigger only when I'm in range of any of the first three beacon regions I started monitoring for.
Thanks,
Piotr Czarnoleski
An iBeacon is a device that emits a Bluetooth signal that can be detected by your devices. Companies can deploy iBeacon devices in environments where proximity detection is a benefit to users, and apps can use the proximity of beacons to determine an appropriate course of action.
We implemented this fusion workflow in an Android smartphone and conducted real-time experiments in a building floor. Two different routes with sharp turns were selected. The positioning accuracy of the iBeacon-based method is RMSE 2.75 m.
Identifying iBeacons To identify each iBeacon, an iBeacon is identified using three numbers: Proximity UUID (16-bytes), Major (2 bytes), and Minor (2 bytes) (see Figure 1). Figure 1: Three numbers are used to identify an iBeacon . The assignment of these three numbers is totally up to the implementers.
Summary: For installations with regular beacons (an iBeacon is a type of beacon) then you cannot do much without an app, as you cannot interact with users (even after the additions from Eddystone).
An iOS device has a limited number of hardware acceleration slots for beacon detection. These slots defer to the bluetooth chip to notify the operating system when a beacon region pattern has been matched. When these slots are used, background detections are very quick -- a region entry event can happen within a second or two of the beacon transmission being in range.
If these slots run out, however, then the operating system must fall back to full scans to find the remaining regions. The operating system throttles these to save battery. Evidence suggests that they take place about every 15 minutes. This means that if any regions monitored by your app that don't get a hardware acceleration slot can take up to 15 minutes to be detected after a matching beacon comes into range (although on average it will often take less time -- 7.5 minutes would be the average)
How many hardware slots are available? This is undocumented and may vary by iOS device model. But experimentation shows it may be about 30. This is across all apps on the phone and is completely unrelated to the 20 region limit per app. The first apps to register regions are the first apps to get the slots.
Read more here: https://developer.radiusnetworks.com/2015/04/21/max-beacon-regions-ios.html
It is possible that the above is what you are experiencing, and there are only 3 hardware acceleration slots left on your phone for your app. To test this theory, you can:
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