Long time before beacon signal triggers in app

Hi. I have an app which monitors for beacon regions. Simplified, when the app enters a region a notification is shown on the phone.

Sometimes, especially when the phone is in sleep, or the app has not been open for a long time, it can take a long time before the push notification appears (and before the didEnterRegion callback is called). Just now, I waited 11 minutes, and I got a push notification.

My questions are:

  1. is the signal sent to the OS approximately right away, and it is the OS that does not bother calling my apps` didEnterRegion before 11 minutes has passed?

  2. or is it that the beacon does not bother to send me signals before 11 minutes after I approached the beacon?

In case 1) I am fine. I have passed a beacon, and I have walked on several hundred meters, but I finally get a message (that I ideally should have gotten 11 minutes ago when I was right next to the beacon). In case 2) there is a problem if I have moved on several hundred meters, and I will never get a signal from the beacon.

The beacon advertises its data on a fixed schedule, by default, every 300 ms. But yes, this is a two’s game—the smartphone needs to be listening, and then needs to propagate the event to your app, which as you noticed, sometimes can take a while. We assume this is because iOS is doing some power management magic.

If you have Location Beacons, you could try our experimental Estimote Monitoring API. First, you’ll need to enable the Estimote Location packet via the Estimote iOS app. And then, use this code:

let monitoringManager = ESTMonitoringManager()
monitoringManager.delegate = self
monitoringManager.startMonitoringForIdentifier("BEACON-CLOUD-IDENTIFIER", inProximity: .Near)
...
func monitoringManager(manager: ESTMonitoringManager, didEnterRangeOfIdentifier identifier: String) {
      print("Entered range of beacon \(identifier)")
}
func monitoringManager(manager: ESTMonitoringManager, didExitRangeOfIdentifier identifier:String) {
      print("Exited range of beacon \(identifier)")
}

Early feedback from developers that tried it says it’s more reliable and timely than the default Core Location based monitoring.

Thanks. Just received our Location beacons today, and I started testing this out. When I start monitoring for identifier, I receive a callback to monitoringManager:didFailWithError: saying Monitoring failed. Error: Error Domain=ESTMonitoringManagerErrorDomain Code=401 "Access was not authorized for this request. Starting monitoring with fallback configuration."

Is it correct that I must create an app in the estimote cloud, and do a [ESTConfig] login before starting monitoring? And if so, do I have to add the beacons I intend to use to the app template? If this is the case, how do I add new beacons later on to the app in Estimote Cloud? I don`t find that option.

Hi @heypiotr, can you please provide me the same code in the Objective-C.

    self.monitoringManager = [[ESTMonitoringManager alloc] init];
    self.monitoringManager.delegate = self;
    [self.monitoringManager startMonitoringForIdentifier:@"123abc<the-identifier>" inProximity:ESTMonitoringProximityNear];

Callback:

- (void)monitoringManager:(ESTMonitoringManager *)manager didEnterRangeOfIdentifier:(NSString *)identifier
{
    NSLog(@"Entered");
}	

And also, remember to make the class where you set it up conform to the ESTMonitoringManagerDelegate protocol.

Solved: I didn`t have to add the beacons I intended to use to the application in Estimote Cloud. I simply just had to log in to any app to make use of the Estimote Cloud API, that seems to be required for using Estimote Monitoring.

Thanks, can you tell me where I can find the startMonitoringForIdentifier which in your case is @“123abc”, should I have to create it or is it already in my Estimote account. And yeah one more thing to ask is that is it only work for the single beacon or for all the beacons which I have purchased ?

I think it works for all of the beacons you call startMonitoringForIdentifier on. It only works with “Location Beacons”, not “Proximity Beacons”.

You can find the identifier either in Estimote Cloud (click on your beacon in your list of beacons. See field Identifier), or in the Estimote App (click on your location beacon either in radar or list view. Scroll down to see the field Identifier).

Thank you very much, It really helps but the identifier is related to particular beacon and I wanted to make it work for all beacons.

I think @heypiotrs code also is targeting one particular beacon… I dont know if there is any way to start monitoring for all beacons with one call tostartMonitoringForIdentifier:`

So, have you got any solution about the first beacon detection, why its taking that much long time to detect the first one?

Yeah, my code is targeting just one beacon, but you can simply add more ESTMonitoringManagers and monitor more beacons. Yes, it’s not the best API, we know (: Estimote Monitoring is still sort of an experiment, so the API will get better with time.

If you don’t want to hard-code the identifiers of the beacons in your app, you can use Estimote Cloud API to fetch them dynamically. There’s even a wrapper in our iOS SDK for the request you’d need: ESTRequestV2GetDevices.

Hello, is it possible to create a Cocoapod in Swift and have the EstimoteSDK as a dependency? I’ll like to be able to create a pod of my implementation of your awesome beacons and just install the pod in the projects I work

Thanks