More Related Content
Similar to Demystifying iBeacons
Similar to Demystifying iBeacons(20)
Recently uploaded(20)
AI: mind, matter, meaning, metaphors, being, becoming, life values by Twain Liu 刘秋艳AI: mind, matter, meaning, metaphors, being, becoming, life values Demystifying iBeacons
- 4. “a new class of low-powered,
low-cost transmitters that
can notify nearby iOS 7
devices of their presence.”
- 7. An app will sense the
presence of a beacon
and can react on it
- 12. A thin layer on top of
CoreBluetooth exposed
via CoreLocation
- 18. A beacon is a peripheral
that advertise information
but it’s not a BLE service
- 22. 1. Scan for beacons
identified with the same
proximity UUID
- 23. 2. Detect if the device is in
the region of one or more
beacons (~70m)
- 25. 4. Use the minor/major
integers to
differentiate beacons
- 28. NSUUID *proximityUUID =
[[NSUUID alloc] initWithUUIDString:@"39ED98FF-2900-441A-802F-9C398FC199D2"];
CLBeaconRegion *beaconRegion =
[[CLBeaconRegion alloc] initWithProximityUUID:proximityUUID
identifier:@"com.company.region"];
!
NSDictionary *beaconPeripheralData =
[beaconRegion peripheralDataWithMeasuredPower:@(-50)];
!
CBPeripheralManager *peripheralManager =
[[CBPeripheralManager alloc] initWithDelegate:self queue:nil options:nil];
[peripheralManager startAdvertising:beaconPeripheralData];
- 30. NSUUID *proximityUUID =
[[NSUUID alloc] initWithUUIDString:@"39ED98FF-2900-441A-802F-9C398FC199D2"];
CLBeaconRegion *beaconRegion =
[[CLBeaconRegion alloc] initWithProximityUUID:proximityUUID
identifier:@"com.company.region"];
!
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
[self.locationManager startMonitoringForRegion:beaconRegion];
- 31. - (void)locationManager:(CLLocationManager *)manager
didEnterRegion:(CLRegion *)region {
[self.locationManager startRangingBeaconsInRegion:region];
}
!
- (void)locationManager:(CLLocationManager *)manager
didExitRegion:(CLRegion *)region {
[self.locationManager stopRangingBeaconsInRegion:region];
}
!
- (void)locationManager:(CLLocationManager *)manager
didRangeBeacons:(NSArray *)beacons
inRegion:(CLBeaconRegion *)region {
if ([beacons count] > 0) {
CLBeacon *nearestExhibit = [beacons firstObject];
!
if (CLProximityNear == nearestExhibit.proximity) {
[self presentExhibitInfo:nearestExhibit.major.integerValue];
} else {
[self dismissExhibitInfo];
}
}
}
- 32. “One way to promote
consistent ranging results
in your app is to use
beacon ranging only while
your app is in the
foreground.”
- 33. “if your app is in the
foreground, it’s likely that
the device is in the user’s
hand.” — Apple BS Group.
- 40. The app receives only a
minor/major number.
It had to fetch information
from the network or a local
database
- 57. Not all is lost!
It will improve but it’s still
radio technology.