didEnterRegion for which region

Suppose I have several Estimotes, I want to show different messages based on the user enter different beacons' region, is it possible to do that?

I tried, as similar as the proximity demo, based on the selectedbeacon's major/minor, I can display different message accordingly.

What about the Notification demo: didEnterRegion?

Specifically, if a user enter the region, is it possible for me to know which beacons' region does he enter?

Hi Godfrey,

Each Beacon is identified by a unique ID (consisting of UUID, Major, Manor) so yes, the app will 'know' when the device enters the region of a specific Beacon.

You should create different ESTRegions with different Majors, Minors and identifiers. Also, you can just start ranging after getting the didEnterRegion message. Then you should get a list of ESTBeacon objects with their Major, Minor and distance. But keep in mind that if ranging is performed while app is only running in the backgroud, it is allowed only for a couple of seconds and might be inaccurate.

Regards.

just like the official answer: use the Major and Minor value to differentiate between the regions. If you use the wildcard values, the app won't know which specific zone it entered, all it will know is that is inside a region.
Define three ESTBeaconRegion variables, initialize them with Major and Minor and identifier and in the didEnterRegion check for the identifier of the region and show appropriate info

Yup, it's pretty much what Narcis says.

You should create different ESTRegions with different Majors, Minors and identifiers. Also, you can just start ranging after getting the didEnterRegion message. Then you should get a list of ESTBeacon objects with their Major, Minor and distance. But keep in mind that if ranging is performed while app is only running in the backgroud, it is allowed for only a couple of seconds and might be inaccurate.

I've updated the official answer with that information.

Regards.

Thanks for your quick reply. I will explain in more details:
Assume I have 3 Estimotes, namely: A, B and C.
I Initialize the Estimote beacon region by: initRegionWithIdentifier. I do not specify the beacons beforehand. It means the Major and minor values will be wildcarded.

When a user enter a region, he will be notified. But he may enter region A, B, or C.
Is it possible for me to know which region does he enter, if I wildcard the Major and Minor value??


What I want is, if he enter region A, the user is notified message like "Welcome to Region A!", and if he leave A and enter region B, the user will received "Welcome to Region B!". But if he enters region C, he will be notified "Welcome to Region C".

So, I would like to customize the notification based on the region the users are locating.

Thank you all of the replies. It is very clear and useful!!!

We have setup several regions and want to show region enter/exit notifications as well as proximity alerts when the app is active.
We tried calling the startRangingBeaconsInRegion method in the didEnterRegion function. But this way never got the didRangeBeacons callback.
Right now the solution is to call startRangingBeaconsInRegion together with startMonitoringForRegion but this triggers the didRangeBeacons every second, even if there are no beacons detected, which seem kind of redundant. Not to mention the effect on battery life.

Does anyone have an idea how to solve this?

Hey Matija—I see nothing wrong here, so not sure why it doesn't work. Could you maybe provide a short snippet of your didEnterRegion code to help illustrate the scenario?

Piotr, thanks for the quick reply.
The code looks something like this:
- (void)beaconManager:(ESTBeaconManager *)manager
didEnterRegion:(ESTBeaconRegion *)region
{

// some core data stuff to identify the region and retrieve the notification text

[manager startRangingBeaconsInRegion:region];

// some analytics stuff

}

I did make a mistake in my previous comment. I tried the whole thing again and the didRangeBeacons actually gets called, the region matches the one that was started ranging, but the beacons array is empty.

Thanks, this is helpful. If you let the ranging go on for a while (you should have around 10 second before the app gets suspended by the iOS again), does the beacon array get populated? It often happens the the first one or two didRangeBeacons calls discover no beacons. Alternatively, you could try upping your beacons' advertising frequency—this should help with responsiveness, at the expense of the battery life though.

I wasn't able to get this to work. Beacons array is always empty.
Except if i called the startRangingBeaconsInRegion together with startMonitoringForRegion.

Did you ever resolve this? I'm having the same issue.

I just saw your answer from here: https://community.estimote.com/hc/communities/public/questions/202180077-Local-notification

Thank you!

@Cody Rotwein
Actually, thank you! I completely forgot about this solution ;)

I think the Estimote guys could easily fix this in their SDK, since we managed to identify the problem.

Hey guys,

First of all, many many thanks for figuring our what the problem is—shame on me I haven't seen Matija's post earlier!

Yes, this does indeed seem like a bug in our SDK. I've just tested with our most recent update (3.0), where we switched from ESTBeaconRegions to plain CLBeaconRegions, and the issue does not appear there. Consider updating! (: