Created
July 25, 2014 21:13
-
-
Save leftspin/3896ad2675c804244a55 to your computer and use it in GitHub Desktop.
Estimote Beacons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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