The didEnterRegion method only gets called when the device enters the beacon region. If the device is already in the range of a beacon that belongs to the region you are monitoring, then the method will not be called.
It is possible to simulate the didEnterRegion by removing the battery from all your beacons and then, simply place it back in for only one of them. If you were already inside the region, and you implemented the didExitRegion method, it will be called after you remove the battery.
If you have Tough beacons, since you can't remove the batteries, one option would be to change the UUID of only one of your Tough beacons and create a beacon region for that UUID in order to monitor it. This way you just have to make sure that you are outside the range of that particular beacon and not worry about the others. You could also place them all in a single room and move your device away from them.
To know if your device is inside or outside a region, use requestStateForRegion. Beacon manager will check where is the device and notify the delegate using the didDetermineState method. There are three possible states: inside the region, outside the region or unknown.
You can learn more about this in our Developers Center under the iOS SDK documentation: iBeacon monitoring and ranging or directly in Apple's Core Location documentation.
Comments
1 comment
I start monitor region as code below:
for (KTKBeaconRegion *region in self.beacon.monitoredRegions) {
[self.beacon stopMonitoringForRegion:region];
}
[self.beacon startMonitoringForRegion:region];
And the beacon is in range. State is CLRegionStateInside.
But the didEnterRegion method is not called. I see it's called just once time when the app is in background. Then I restart app, it's not called again.
Do you any ideas?
Please sign in to leave a comment.