iBeacons is a protocol on top of Bluetooth LE (Low Energy, also advertised as Bluetooth Smart, and part of the Bluetooth 4.0). It doesn't require any new hardware and is nothing really new by itself. What's new and exciting is its position in iOS: first-class citizen, integrated with CoreLocation, working in the background, ...
The recipe: advertising your position
As of now, the only objects you can use as iBeacons are iOS devices. The protocol should be made available soon, allowing 3rd party components to appear, and at that time they should sell for a few dollars a piece (based on a general purpose BT chip, like the BLE112, a beacon should cost around 40$ to build. Prices will surely drop by using cheaper and specialized chips).
Turning your iOS device into a beacon is really only a few steps:
1. Initialize a CLBeaconRegion
That'll be your beacon. uuid and identifier are mandatory. Major and minor are optional. There's a trick here, uuid doesn't have to be unique. All beacons of a common group will probably have the same uuid, and different major/minor versions.
var beaconId = new NSUuid ("5a2bf809-992f-42c2-8590-6793ecbe2437"); //uuidgen on MacOS, nguid in VS
var beaconRegion = new CLBeaconRegion (beaconId, "yourOrg.yourBeacon");
2. Initialize a CBPeripheralManager
var peripheralManager = new CLPeripheralManager (new PeripheralManagerDelegate(beaconRegion), DispatchQueue.DefaultGlobalQueue, new NSDictionary ());
class PeripheralManagerDelegate : CBPeripheralManagerDelegate
public CBPeripheralManager (CLBeaconRegion beaconRegion)
this.beaconRegion = beaconRegion;
public override void StateUpdated (CBPeripheralManager peripheralManager)
//State will be Unsupported on devices like iPhone4 and prior, PoweredOff if BT is down
if (peripheralManager.State != CBPeripheralManagerState.PoweredOn)
var options = beaconRegion.GetPeripheralData (null);
And that's it.
Notes and further reading
- As devices BT ids changes from time to time, your device will be sometimes advertised twice. That won't happen with real iBeacons.
- If you want to advertize in the Background, enable "Acts as Bluetooth LE accessory" in your info.plist
- Read Region Monitoring if you need more details.