Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Xamarin iBeacon Mini-hack using Estimote iBeacons

2,851 views

Published on

Slides from the Birmingham Xamarin user group meeting:

A little less conversation, a little more iBeacons…

iBeacons are a cool technology that allows you to add location awareness to you apps, not based on your location on a map, but based on your proximity to iBeacons, be they at a fixed or moving point. They allow your apps to have an accurate understanding of where you are both inside and out, from sending you offers when you are in a shop to knowing where you are in a sports stadium so you can be directed to your seat. iBeacons are a big up and coming thing - even Facebook are now sending them out to businesses so their app can become location aware. Companies like Estimote are creating and extending iBeacons to bring even more amazing features to the developer.

In this mini-hack I’ll be talking briefly about this technology and a little about it’s uses, then we’ll hit the code. Bring a Mac laptop, iPhone and lightning cable, and team up with others in building a treasure hunt app using the Estimote iOS Xamarin component and Estimote iBeacons. There will be a prize of an Estimote developer kit or two (containing 3 iBeacons, worth $100 each) for the team that can complete the treasure hunt the fastest.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Xamarin iBeacon Mini-hack using Estimote iBeacons

  1. 1. A little less conversation, a little more iBeacons Estimote iBeacons mini-hack Jim Bennett @JimBobBennett http://JimBobBennett.io
  2. 2. What are we going to do tonight? • A quick overview of iBeacons • The cool things you can do with them • Hands on with the Estimote Xamarin component • Lets play! Team up and build a treasure hunt app, and win some beacons
  3. 3. What are iBeacons? • Bluetooth LE devices • Broadcast a fixed format message defined by Apple on a periodic basis • Message has an Id, version (major, minor), measured power • Multiple iBeacons can have the same Id, versions can be use to distinguish different iBeacons
  4. 4. How do they interact with your app? • Apple defines an API to interact with iBeacons as part of CoreLocation • Apps can register to monitor a region - all beacons with a given Id • Monitoring notifies when an iBeacon moves in or out of range • Monitoring can happen in the background and will launch your app • Once your app is in the foreground, you can range the iBeacons to get their proximity/distance as it changes
  5. 5. What does this mean for your app? • Indoor location awareness • Context awareness
  6. 6. What apps can you build to take advantage of this? • Museum guide - app knows which exhibit you are standing next to and plays the correct audio • Theatre location - app can pinpoint your location and direct you to your seat • Shopping - notifications of special offers when you are next to the items on offer • Respond to indoor location - turn your lights off when you put your phone down on your bedside table, notify friends when you are home safe
  7. 7. Problems! • Security - anyone can read your beacon by scanning for Bluetooth devices and spoof your id • Power - some iBeacons run off the mains so need socket, battery powered ones will die and need replacing • Accuracy - not very, for example in a busy location people can decrease signal strength • No simulator support - need an actual device for debugging
  8. 8. Estimote iBeacons • Estimote have extended the capabilities of their iBeacons • Distance measurements, flip to power off • Indoor location SDK • Android support • Xamarin component • Nearables • Strong developer community support • Other iBeacon providers are available
  9. 9. Best of all! Free beacons! 2 dev kits to be given away, everyone gets 10% off their first Estimote order and Stickers for everyone
  10. 10. Code Examples at: https://github.com/jimbobbennett/iBeaconsMiniHack https://gist.github.com/jimbobbennett
  11. 11. Step 1 - add the component • Install the Estimote SDK for iOS component
  12. 12. Step 2 - add the permissions • Need either NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription set
  13. 13. Step 3 - Setup the BeaconManager and authorise • Create a BeaconManager - this wraps CLLocationManager • Listen for changes to the authorisation status • Request permission
  14. 14. Step 4 - Start ranging beacons • To range you need to specify a region • Each region is based on a UUID and optionally a major and minor version • Each region must have a name and you can use this in the event handler to correctly handle the ranging of beacons from multiple regions • By default all brand new Estimote iBeacons have a UUID of B9407F30-F5F8-466E-AFF9-25556B57FE6D
  15. 15. Step 5 - Handle the ranged beacons • The Ranged event provides a list of beacons • Contains just the one that was ranged, or all of them depending on the setup
  16. 16. Gotcha’s • Distance of -1 • Means not enough signal or advertising packets - ramp up the broadcast rate • Checking for equality • Beacons are equal if the UUID/version matches. Beacons in the event args are new instances. • Not working - check authorization! • Make sure your code requests authorization and handles the denied case.
  17. 17. Lets find some treasure! Your challenge: Form small teams - ideally 3 to a team There will be 3 beacons hidden in another room Write an app to find the beacons and record the letters written on each Each team will enter the room one at a time - the fastest team to locate them all wins some booty - an Estimote iBeacons dev kit with 3 iBeacons - worth $100 Afterwards each team will show off their results. The team with the best app wins another Estimote dev kit
  18. 18. Useful links • http://estimote.com • https://gist.github.com/jimbobbennett/07fb701789abce7bdc8b • https://github.com/jimbobbennett/iBeaconsMiniHack • https://developer.apple.com/library/ios/documentation/UserExperience/ Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring .html#//apple_ref/doc/uid/TP40009497-CH9-SW1 • http://motzcod.es/post/105283789517/ios-ibeacon-background-region- monitoring • http://motzcod.es/post/97662738237/scanning-for-ibeacons-in-ios-8 • https://www.brooklynmuseum.org/community/blogosphere/2015/02/04/t he-realities-of-installing-ibeacon-to-scale/

×