Local notification

How do I retrieve the major value of the region? I have a unique UUID with different major and minor.

Always in the event the value of didEnterRegion region.major variable is nil!

Follow my code:

ESTIMOTE_UUID = [[NSUUID alloc] initWithUUIDString:@"B9407F30-...-25556B57FE6D"];
self.currentRegion = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_UUID
                      identifier:@"RegionIdentifier"];
self.currentRegion.notifyOnEntry = true;
self.currentRegion.notifyOnExit = true;

[self.beaconManager startMonitoringForRegion:self.currentRegion];

.....

-(void)beaconManager:(ESTBeaconManager *)manager
didEnterRegion:(ESTBeaconRegion *)region
{
if(region.major != nil) {
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = [NSString stringWithFormat:@"Beacon: %@ / %@", region.major, region.minor];
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
}

Hi Homero,

In the didEnterRegion event you get the same ESTBeaconRegion object so if you created it using only proximityUUID it won’t have the major nor minor propperty filled. If you want to find out which beacon triggered that event you can startRanging inside the didEnterRegion event. You have a couple of secodns to do it in the background.

Also keep in mind, that if you created a region using proximityUUID only, you won’t get separate enter/exit region events for each beacon with that proximityUUID. If you want to get separate background events for each beacon, you have to create separate ESTBeaconRegion objects with specified major/minor or both. There is a limit of 20 regions that iOS can monitor per app.

Hello!

I tried ranging for beacons in the region from the didEnterRegion event and got an empty beacons array in the didRangeBeacons method.
Any idea of another way to get the beacon id's in the background?
Thanks!

I found the reason for the empty array.

In the start i created and started monitoring the region initialized only by the UUID with the method - initWithProximityUUID:identifier:

This region has major and minor parameters set tu "null".

If i started ranging for beacons in the region returned in the didEnterRegion event i got an empty beacons array in the didRangeBeacons method.
I found out that this region has major and minor parameters set to 0 (and not "null").

The solution was to startRanging in a region that was created in the beginning or to create a new one with the - initWithProximityUUID:identifier: method and pass it into the startRanging method.

This seems like a bug either in the Estimote SDK or Apple's CoreLocation framework.

Hi Matija,

We're not yet sure why it happens like this, but indeed it does. I checked with our Examples app and not setting major/minor gives nil values and returned region after ranging has zeros. This is probably how it just works with Apple.

@Ula Kierwiak
Could you please look into the possibility of fixing this in Estimote SDK.
I'm just guessing, but Estimote SDK being basically a wrapper for native iOS classes it shouldn't be that hard.