Skip to content

Instantly share code, notes, and snippets.

@leftspin
Created July 25, 2014 21:13
Show Gist options
  • Save leftspin/3896ad2675c804244a55 to your computer and use it in GitHub Desktop.
Save leftspin/3896ad2675c804244a55 to your computer and use it in GitHub Desktop.
Estimote Beacons
// In our location manager's init:
_estBeaconManager = [[ESTBeaconManager alloc] init];
_estBeaconManager.delegate = self;
ESTBeaconRegion *region = [[ESTBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:beaconUUID] identifier:@"com.delectable.beacon"];
region.notifyEntryStateOnDisplay = YES;
[_estBeaconManager startMonitoringForRegion:region];
// The delegate methods:
- (void) beaconManager:(ESTBeaconManager *)manager didEnterRegion:(ESTBeaconRegion *)region
{
NSLog(@"Entered region: %@" , region);
[_estBeaconManager startRangingBeaconsInRegion:region];
}
- (void) beaconManager:(ESTBeaconManager *)manager didExitRegion:(ESTBeaconRegion *)region
{
NSLog(@"Exited region: %@" , region);
[_estBeaconManager stopRangingBeaconsInRegion:region];
}
- (void) beaconManager:(ESTBeaconManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(ESTBeaconRegion *)region
{
NSLog(@"ping");
if(beacons.count > 0) // beacons is always empty when using an estimote device
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment