47
iBeacons for Everyone! From iOS to Android James Montemagno Developer Evangelist, Xamarin @JamesMontemagno

iBeacons for Everyone, from iOS to Android - James Montemagno | FalafelCON 2014

Embed Size (px)

Citation preview

iBeacons for Everyone! From iOS to Android!

James Montemagno!Developer Evangelist, Xamarin!@JamesMontemagno!

Who is this guy?!

James Montemagno!Developer Evangelist, Xamarin!

@JamesMontemagno !!http://motzcod.es!

MyStepCounterApp.com!

What is an iBeacon?

•  Apple calls it: •  “A new class of low-‐powered, low-‐cost

transmitters that can notify iOS devices of their presence.”

•  What does this mean? •  Devices that can notify apps of exact device

proximity and location awareness that was never before possible.

What is it really?

A Device •  What you place around and will

transmits data to your app.

An API •  What you use to detect the devices in

your apps.

Devices

•  Your iOS 7.0+ Device •  iPhone 4S, iPad 3rd Gen+, iPad Mini,

iPod Touch 5th Gen+ •  Even your Mac!

•  Not your Android device… yet. •  Android L introduces this.

•  Cute Little Devices You Buy •  Estimotes

•  Nearables & Beacons •  Radius Networks –RadBeacon •  Roximity •  Onyx Beacon •  ….About 100 other ones

How they work

Bluetooth 4.0 Low Energy!§  Used for all communication!

Spec Classic Bluetooth Bluetooth LE

Distance/Range (theoretical)

100 m (330ft) 50 m (160ft)

OTA Data 1-3 Mbit/s 1 Mbit/s

Application throughput

.7-2.1 Mbit/s .27 Mbit/s

Security 56/128-bit 128-bit AES

Peak current Consumption

<30 mA <15 mA

Power Consumption 1 mW .01 – .5 mW

Latency 100ms 6ms

Voice YES NO

“Fun” Bluetooth Stats!

•  GATT (﴾Generic Attribute Profile)﴿ •  UUIDs!

•  Flow:

Client  

•  Ini*ate  commands  &  requests  •  (Computer  /  Phone)  

Server  

• Receives  GATT  commands  •  (Temperature  Sensor  /  iBeacon)  

Characteris*cs  

• Data  value  transferred  • BaDery  Voltage  

Service  

• Collec*on  of  related  Characteris*cs  (perform  a  specific  func*on)  • Temperature  measurements  &  *me  intervals  

Descriptor  

• Provides  addi*onal  informa*on  about  characteris*c  • Units  (F  vs  C)  • Op*onal  

-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐Attributes -‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐

How BLE Works!

•  UUID – Universally Unique Identifier •  Region:

•  Major Number •  Minor Number

iBeacons Transmit!

•  Push Notifications to Receivers/Devices •  Track Users

They do NOT!

API

Region Monitoring Ranging

Region Monitoring!•  Notified on entry/exit of

region

•  Works if phone is locked

•  Works if app is in background

•  Search for all Beacons with specific properties •  Works in foreground •  Proximity Monitoring

•  Immediate – Centimeters/Held up to beacon •  Near – 1 to 3 meters •  Far – In detection range •  Unknown – Proximity can not be determined

or ranging has just begun.

Ranging!

Ranging in Action!

•  Your iOS 7.0+ Device •  iPhone 4S, iPad 3rd Gen+, iPad Mini, iPod Touch 5th Gen+

•  Your Android Device

•  Android 4.3+ (﴾JellyBean)﴿ Devices •  With BLE!

•  Nothing on Windows Phone or Windows 8 yet L

What can find iBeacons?!

What can we do with them?

•  UUID – Universally Unique Identifier •  Region:

•  Major Number •  Minor Number

iBeacons Transmits!

http://appleinsider.com/articles/13/12/06/first-look-using-ibeacon-location-awareness-at-an-apple-store

Apple Store!

An example!

•  Museums •  Scavenger Hunts •  Athletics •  Restaurants •  About a gazillion other things!

So much more!!

iOS Demo

Why C#? Why Xamarin?

Automatically test your app on!hundreds of mobile devices !

Create native iOS, Android, Mac and Windows apps in Visual Studio and C#

Architecting !Mobile Apps!

The Silo Approach!

Build App !Multiple Times!

The Write-Once-Run-Anywhere Approach!

Lowest Common!Denominator!

Xamarin’s Unique Approach!

Native With !Code Sharing!

Windows APIs!

iOS APIs | 100% Coverage!

Android APIs | 100% Coverage!

iOS Demo

•  Background Notifications! •  Location Permissions (﴾opt-‐out)﴿

How iOS 7.1 Changed Everything!

•  More Opt-‐In Features •  Never •  Always •  When App is Open

•  Enhanced Home Screen •  Indoor location tracking

What’s new in iOS 8!

•  Must Request Authorization 1.  RequestWhenInUseAuthorization(﴾)﴿; 2.  RequestAlwaysAuthorization(﴾)﴿;

•  Must add message to Info.plist

How iOS 8 Broke Everything!

Estimote SDK

Radius Networks iBeacon Service

Android Development!

Android Demo

Resources!•  Code:

•  https://github.com/jamesmontemagno/iBeaconsEverywhere

•  Xamarin.com •  Estimote.com

•  Android Bluetooth Docs: •  http://developer.android.com/guide/topics/connectivity/bluetooth-‐le.html

•  iOS Beacons Docs: •  https://developer.apple.com/ibeacon/Getting-‐Started-‐with-‐iBeacon.pdf

Get Started Today: xamarin.com/download!

Q & A!!Get your free C# t-shirt:!xamarin.com/shirt!

Find Me:!@JamesMontemagno | @XamarinHQ!http://motzcod.es | http://blog.xamarin.com!