iBeacon Development on iOS

of 48/48
iBeacon Development on iOS Ole Begemann
  • date post

  • Category


  • view

  • download


Embed Size (px)


Workshop summary: Overview about iBeacons and Bluetooth LE Region monitoring with iBeacons Proximity ranging with iBeacons New iBeacon features in iOS 8 Playing with the iBeacon infrastructure at Betahaus Common problems in working with iBeacons Slides from July 17th event at Betahaus Berlin.

Transcript of iBeacon Development on iOS

  • iBeacon Development on iOS Ole Begemann
  • Agenda Working with iBeacons on iOS Explore iBeacons at Betahaus Discussion/Q&A
  • What are iBeacons?
  • Based on Bluetooth LE Very simple Passive
  • Advertising Permanent Advertising 100500 ms intervals Beacons dont see other devices Range: 50-100 m (510 m indoors)
  • Beacons transmit 3 numbers Proximity UUID Major Minor
  • Proximity UUID 010A6F6A-DD12-4B07-A56C-EBA3BCF7136A Usually the same for all beacons in one installation 128 bits is enough to be globally unique
  • Major and Minor 0...65,535 Congure in way that makes sense for your installation
  • www.open-location-berlin.com
  • iBeacon APIs
  • iBeacon APIs Core Location (and not Core Bluetooth) Region Monitoring Ranging API is extremely simple
  • Region Monitoring
  • Region Monitoring Detect when a beacon comes in or out of range Monitor a single beacon or a group Can be used in the background
  • Always Check Availability and Authorization [CLLocationManager authorizationStatus] [CLLocationManager isMonitoringAvailableForClass: [CLBeaconRegion class]]
  • CLBeaconRegion identifier proximityUUID major minor notifyOnEntry notifyOnExit notifyEntryStateOnDisplay
  • Region Monitoring NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"F0018B9B-7509-4C31-A905-1A27D39C003C"]; CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"My Region"]; ]; [self.locationManager startMonitoringForRegion:region];
  • Region Monitoring: Delegate Methods - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region - (void)locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region withError:(NSError *)error
  • Region Monitoring [self.locationManager stopMonitoringForRegion:region]; [self.locationManager requestStateForRegion:region];
  • Proximity Ranging
  • Ranging Continuous updates (every second) Monitor proximity and (estimated) distance Does not work in the background
  • Check Availability [CLLocationManager isRangingAvailable]
  • Proximity Ranging [self.locationManager startRangingBeaconsInRegion:region]; [self.locationManager stopRangingBeaconsInRegion:region];
  • Proximity Ranging: Delegate Methods - (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region - (void)locationManager:(CLLocationManager *)manager rangingBeaconsDidFailForRegion:(CLBeaconRegion *)region withError:(NSError *)error
  • CLBeacon proximityUUID major minor proximity accuracy rssi
  • proximity CLProximityImmediate (centimeters) CLProximityNear (< 23 m) CLProximityFar CLProximityUnknown
  • accuracy Indicates the one sigma horizontal accuracy in meters. Use this property to dierentiate between beacons with the same proximity value. Do not use it to identify a precise location for the beacon. Not a distance estimate!
  • rssi Received signal strength Measured in decibels
  • Demos
  • Museum Uses ranging to display information about a piece of art when the associated beacon is in immediate or near proximity.
  • BEACONinside github.com/beaconinside/ BEACONinside-SDK-iOS Uses the BEACONinside SDK (built on top of Core Location APIs)
  • oleb.net/les/ibeacon-workshop.zip
  • Common Problems
  • Region Monitoring Region Exit is not immediate (15 seconds or more) Enter and Exit events can take up to 15 minutes in the background region.notifyEntryStateOnDisplay = YES http://developer.radiusnetworks.com/2013/11/13/ ibeacon-monitoring-in-the-background-and- foreground.html
  • Ranging Intermittent signal loss Signal strength is not a reliable measure for distance Apps should apply signal smoothing
  • Creating iBeacons
  • Turn your device into a beacon CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:... major:... minor:... identifier:...]]; NSDictionary *peripheralData = [region peripheralDataWithMeasuredPower:nil]; self.peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil]; [self.peripheralManager startAdvertising:peripheralData];
  • Core Bluetooth
  • Core Bluetooth Used to actively connect to Bluetooth LE devices Devices oer services and characteristics Not required for iBeacons, but many iBeacons oer additional functionality via Core Bluetooth
  • Agenda Working with iBeacons on iOS Explore iBeacons at Betahaus Discussion/Q&A
  • Agenda Working with iBeacons on iOS Explore iBeacons at Betahaus Discussion/Q&A
  • Limitations on iOS Scanning for beacons with unknown UUIDs is not possible
  • App Store Policy Not permitted to expose UUIDs to users Makes it dicult to write apps that work with the users own beacons
  • Documentation
  • developer.apple.com/ibeacon/
  • Thank you @olebegemann [email protected] oleb.net