Bluetooth iOS 8

There are some cases (don’t know exactly why it happens) when the monitoring doesn’t receive any enter/exit events. After restarting the iPhone’s bluetooth then everything works as expected.

Did anybody experience this problem before? I am using the Estimote SDK 3.2.7

Enter and exit events are delivered by monitoring, not ranging, is that what you had in mind?

What’s your testing procedure? I’ll check if I can replicate it.

Could you also implement the didDetermineState delegate and see if that one’s getting called?

Sorry, I’ve fixed my post. Yes, I was talking about monitoring. I just started a normal monitoring like this:

When this method is called:
func beaconManager(manager: AnyObject!, didStartMonitoringForRegion region: CLBeaconRegion!) {

Then I called also this method:

I’ve received state 2, but the enter/exit methods were never got called.

This use case happened to me 2 times, but I cannot see the source of it, so I cannot reproduce it.

I’ve created a movie about it:

You can also see my code. When the app starts to run, I am calling the startMonitoring() method from the app delegate’s application(application:didFinishLaunchingWithOptions: [NSObject : AnyObject]?) -> Bool method.

Also, you can see my console that when the up starts, the state is 0, after a few seconds it turns to 2 and nothing else happens.

The didStartMonitoringForRegion method is called, but there are no enter/exit events.

Enter/exit will only happen when you move in and out of range of the beacon.

State “0” means “unknown”, i.e. iOS is still figuring out whether you’re inside or outside range. State “2” means you’re outside range, so either your beacon is not there, or the UUID you’re using in your region (Statics.BeaconUUIDString) doesn’t match that of the beacon.

Outside of a range does mean that the phone is not in the range of the beacon (so the phone is far way from the beacon)? Also, what’s the difference between an exit event and the “state 2” event?

The UUID is the same as the devices UUID (double checked).
The beacon is on the phone (like when I am updating the firmware).

I don’t know why the code receives that it is outside of the range.
In the official Estimote app everything is ok. It is slower than usual, but it works.

Currently it doesn’t help if I restart my bluetooth on the phone.

Currently I’ve tried to run the example app. I’ve noticed that that when I try to use the utilities demo, I receive the list of beacons, but with other examples I don’t. Verified the example source codes and noticed that the utility delegates are called, but the beacon manager’s delegates are not called as in my application.

The official Estimote application is working without problems. Do you have any clues why this can happen? Am I doing anything wrong?

The utilities section uses Core Bluetooth, and the other sections use Core Location. The latter requires the app to be granted permissions to use Location Services, can you check for that in your Settings?

Yes, the app has the permissions.

I’ve read through the all the documentation I’ve found here on the site and some of the Apple’s docs too. I’ve seen that there is a limit for ranges (20 ranges). I’ve also debugged the application and noticed that if I stop the application from XCode and then restart it again then it can happen that the region monitoring remains there even if I call the stop monitoring method when the application calls the will terminate delegate method. I’ve tried to stop those “dead” monitored ranges before I start new ones and after more than a day the application started to work, but there are still cases when I start the application, clear the old ranges and the new one doesn’t work. After restarting the app 1-2 times, the application works again.

Ok, I know that the whole issue was caused by me, but do you think is there anything else that I am doing wrong, because there are still some reliability problems?

The monitored regions persist between app redeployments and relaunches—that’s the whole idea behind monitoring, i.e. it works also when you app gets killed, or you reboot the phone etc.

You can remove regions from monitoring with the stopMonitoring method (the region identifiers need to match) or uninstall the app.

You can use the CLLocationManager/ESTBeaconManager’s monitoredRegions property to see which regions are currently being monitored, and stop monitoring the ones you no longer want to use. You then should be able to immediately start monitoring new regions.

Do you have any other apps monitoring for beacons? There are some suspicions in the iBeacon community that there’s a global limit of 30 regions to be monitored. After reaching that, any additional regions monitored will be much less reliable, sometimes taking up to 15 minutes to trigger.

If you start the Estimote app and go to the “devices” section, does it trigger enter/exit events for your own app? (Estimote app will start ranging, which forces the Bluetooth radio into an active scanning mode, and should result in all the enter/exit events for the other apps to be delivered immediately.)