iosswift3ibeaconclregion

didRangeBeacons is called even beacon is off


I am implementing the IOS application with swift 3.0 which can monitor nearby beacons. I have an issue relating didRangeBeacon function, Detail reproduces steps below:

1- Application has entered beacon region

2- beacon is turned off

3- In next 10 seconds, didRangeBeacon function is still called and response still has one beacon object.

So I can not recognize beacon is off immediately. How can I recognize beacon is off immediately?


Solution

  • In case of iBeacon, the area is defined by the range of one or more beacons. This allows more granularity and precision than regular geofencing—the latter being based on a mix of signals from cell towers, WiFi and GPS. Beacon geofences are also more responsive: “enter” events usually take up to a few seconds to trigger, “exit” events up to 30 seconds. (Regular geofences take “3 to 5 minutes on average”, according to the CLLocationManager’s documentation.)

    Testing “enter” events involves making sure you’re “outside” the region. Enabling “flip to sleep” makes it easy to simulate going out of range. “Enter” events take up to a few seconds to trigger, while “exit” events take up to 30 seconds.

    Region monitoring is pretty slow, you can use it for more general notification to let you know. You can use this signal strength to decide if you no longer see the beacon (CoreLocation tends to still "see" the beacon a few seconds after it disapears).