Schedule a Demo

Close

ibeacon apple for developers

Here we will try to answer some questions about Ibeacon apple

What are ibeacons ?

Based on Bluetooth LE

Very simple

Passive 

Advertising

Permanent Advertising 100–500 ms intervals

Beacons donʼt see other devices Range: 50-100 m (5–10 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

Configure in way that makes sense for your installation

 

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 (< 2–3 m) CLProximityFar CLProximityUnknown

accuracy

“Indicates the one sigma horizontal accuracy in meters. Use this property to differentiate 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)

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

Used to actively connect to Bluetooth LE devices Devices offer services and characteristics

Not required for iBeacons, but many iBeacons offer additional functionality via Core Bluetooth

Limitations on iOS

Scanning for beacons with unknown UUIDs is not possible

App Store Policy

Not permitted to expose UUIDs to users

Makes it difficult to write apps that work with the userʼs own beacons

Documentation

Share Button