I am into Estimote Beacon app development and was able to send notifications using the sample app where the UUID, Major and Minor values are explicitly hardcoded in the code. I want the below requirement to be implemented using Objective C.
I was able to send notifications using the below code with hardcoded UUID, Minor and Major values.
The code which is working for me is the below one:
self.beaconNotificationsManager = [BeaconNotificationsManager new];
[self.beaconNotificationsManager enableNotificationsForBeaconID: [[BeaconID alloc] initWithUUIDString:@"MY UUID" major: 10708 minor:33584] enterMessage:@"Enter Message." exitMessage:@"Exit Message"];
Thanks, SIB Mobile Developer
You can use Ranging Beacons to achieve sending 'Entry' and 'Exit' notification and background service call.
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"YOURUUID"];
self.beaconManager = [[ESTBeaconManager alloc] init];
self.beaconManager.delegate = self;
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"RegionIdenifier"];
self.beaconRegion.notifyOnEntry = YES;
self.beaconRegion.notifyOnExit = YES;
self.beaconRegion.notifyEntryStateOnDisplay = YES;
Then to send notification inside Delegate method:
-(void)beaconManager:(ESTBeaconManager *)manager didEnterRegion:(CLBeaconRegion *)region
{
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = @"Enter region notification";
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
-(void)beaconManager:(ESTBeaconManager *)manager didExitRegion:(CLBeaconRegion *)region
{
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = @"Exit region notification";
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}