Intro to ibeacons


A Xamarin focused introduction to proximity detection with bluetooth low energy beacons



Rod Howarth
@rodh257







About Me

  • Web & Mobile developer at Envoy
  • ASP.NET MVC + C#
  • Xamarin & native app experience



rodhowarth.com
envoyat.com  


What are iBeacons

  • Apple's trademark/spec for Bluetooth Low Energy 'beacons'
  • Small battery powered devices that transmit a signal regularly
  • iPhone, iPads detect and trigger events 
  • Proximity detection
  • Estimate distance to beacon

What can you do with them?

  • Increase context - detect your surroundings
  • Notifications & events based on proximity
    • Alert about deals
    • Museum exhibits
    • Home automation
    • Open tickets / loyalty card
  • Indoor navigation 
  • Virtual leash
  • Inventory management

Must have app installed

In Use

Virgin Atlantic Heathrow - Passbook
Major League Baseball - Stadium Experiences
Geelong Cats Simonds Stadium
Apple Stores 
Westpac trialing in branches
Museums (Rubens House)
Mt Ommaney Shopping Centre + 45 more coming in AUS




Types of iBeacons

Estimote
Stick'N'Find 
Kontakt .io
Bluecats, Sonic Notify, Bluesense etc
 

Any iOS7 iPhone/iPad
Macbook Pro (using QuickBeacon)

Characteristics

Battery life (1-9 years)
Size 
Temperature Sensors
Accelerometer
Power Level
Range (as far as ~70m)
SDK's 


IDentifying Them

  • UUID
    • Identifies owner
    • 128-bit value
  • Major
    • 16-bit unsigned int
    • Used to group beacons with the same UUID
  • Minor
    • 16-bit unsigned int
    • Used to differentiate beacons within the same Major

Monitoring vs Ranging

Monitoring triggers when you come in range of a region
(region being UUID/Major/Minor)

Ranging can then be started to determine distances
Near, Far, Immediate

Can see distance in meters, but it's inaccurate (interference)

Ranging has higher battery use 


Technical Details

Format specified by Apple

http://www.warski.org/blog/2014/01/how-ibeacons-work/
http://stackoverflow.com/questions/18906988/what-is-the-ibeacon-bluetooth-profile 


Sample

Monitoring + Ranging in iOS

Tips

Environment is important

Calibrate power level in your environment

Ranging is for foreground only 

Many beacons can have power level configured
(could remove the need for ranging)

Use multiple beacons to get a better fix on location


Responsiveness

Detecting region change can take up to 15 minutes!

1 second when ranging
NotifyEntryOnStateDisplay triggers on phone awakening


Great article:
http://developer.radiusnetworks.com/2013/11/13/ibeacon-monitoring-in-the-background-and-foreground.html 


Android

Not as well supported as iOS, but possible
Radius Networks component in Xamarin component store
Only for Android devices with Bluetooth LE
(Android 4.3 and up - 23%)

Samsung has a proprietary SDK for some older devices

Chews more battery life as its not built into OS
(hopefully announcements at Google IO?)

Android Component


Component here:
http://components.xamarin.com/view/xamarin-android-ibeacon-service

Example here:
http://blog.xamarin.com/use-ibeacons-in-android-with-c/

Similar API to iOS

Links


estimote.com
sticknfind.com
kontakt.io
store.radiusnetworks.com
developer.radiusnetworks.com/ibeacon/android/





Articles

http://www.warski.org/blog/2014/01/how-ibeacons-work/

http://www.thoughtworks.com/insights/blog/semi-technical-lowdown-working-ibeacons 

http://developer.radiusnetworks.com/2013/11/13/ibeacon-monitoring-in-the-background-and-foreground.html

Samples

https://github.com/RodH257/xamarinIosBeaconSample


http://blog.xamarin.com/play-find-the-monkey-with-ios-7-ibeacons/


https://github.com/xamarin/monotouch-samples/tree/master/AirLocate


http://www.knowing.net/index.php/2013/09/19/xamarin-code-for-ibeacons/


https://github.com/chrisriesgo/FindTheMonkey-Android