Slide 1

Slide 1 text

Using iBeacons in iOS with Swift M AT T N E D R I C H

Slide 2

Slide 2 text

ABOUT ME AT O M I C O B J E C T M AT T N E D R I C H @ M AT T N E D R I C H M AT T. N E D R I C H @ AT O M I C O B J E C T. C O M

Slide 3

Slide 3 text

What is an iBeacon?

Slide 4

Slide 4 text

Bluetooth Low Energy (BTLE) device Broadcasts a fixed one-way message at a regular time interval Devices can listen for messages and react appropriately WHAT IS AN IBEACON?

Slide 5

Slide 5 text

One-way is important! No “connection” is made Repeated BTLE advertising packet WHAT IS AN IBEACON?

Slide 6

Slide 6 text

WHAT IS AN IBEACON? B

Slide 7

Slide 7 text

WHAT IS AN IBEACON? B !

Slide 8

Slide 8 text

What can you do with them?

Slide 9

Slide 9 text

GPS works well outside, but doesn’t work well indoors iBeacons can pick up this slack Applications Context aware content delivery (advertising) Passive Tracking INDOOR LOCATION SENSING

Slide 10

Slide 10 text

Museum Place an iBeacon at each exhibit Store (e.g., Walmart) Detect when a customer is in a certain aisle, and deliver an advertisement to them CONTEXT AWARE CONTENT DELIVERY

Slide 11

Slide 11 text

Detect when users walk past houses for sale, or apartments for rent Detect when users walk past your business CONTEXT AWARE CONTENT DELIVERY

Slide 12

Slide 12 text

Stores can place beacons throughout and monitor customers as they move Traffic analysis, detect common routes Help detect over and underutilized areas PASSIVE TRACKING

Slide 13

Slide 13 text

http://blog.mowowstudios.com/2015/02/100-use-cases- examples-ibeacon-technology/ MANY MORE APPLICATIONS

Slide 14

Slide 14 text

CONFIDENTIAL IDENTIFIED BY THREE NUMBERS U U I D M A J O R N U M B E R 2 1 M I N O R N U M B E R 3

Slide 15

Slide 15 text

UUID, MAJOR, MINOR Broadcast in every packet Configurable Allow for nice addressing schemes

Slide 16

Slide 16 text

Who makes iBeacons?

Slide 17

Slide 17 text

Apple Makes iBeacons? T R U E O R FA L S E

Slide 18

Slide 18 text

False

Slide 19

Slide 19 text

Apple defined protocol Many beacon manufacturers Usually offer a companion app to connect to and configure their iBeacons BEACON MANUFACTURERS

Slide 20

Slide 20 text

Each manufacturers beacons vary Battery life Battery replaceability Range Configurability Other protocols in addition to iBeacon BEACON MANUFACTURERS

Slide 21

Slide 21 text

Some manufacturers offer an SDK Can simplify high level operations However, you do not need to use this BEACON MANUFACTURERS

Slide 22

Slide 22 text

BEACON MANUFACTURERS E S T I M O T E R A D I U S N E T W O R K S B L U E S E N S E B L U E C AT S

Slide 23

Slide 23 text

BEACON MANUFACTURERS E S T I M O T E R A D I U S N E T W O R K S

Slide 24

Slide 24 text

Apps allow for configuration UUID Major Number Minor Number BEACON CONFIGURATION

Slide 25

Slide 25 text

Advertising Interval and broadcast strength are also configurable (usually) BEACON CONFIGURATION

Slide 26

Slide 26 text

iOS Programming Model

Slide 27

Slide 27 text

CoreLocation framework Hides the BTLE nature of beacons Some abstraction overlaps other location mechanisms (e.g., geo fencing) IOS PROGRAMMING MODEL

Slide 28

Slide 28 text

Step 0 - Permission

Slide 29

Slide 29 text

NSLocationWhenInUseUsageDescription Monitor or range when the user has the app open NSLocationAlwaysUsageDescription Monitoring when the app is in the background PERMISSION - INFO.PLIST

Slide 30

Slide 30 text

CLLocationManager requestWhenInUserAuthorization() requestAlwaysAuthorization() Must call one before you start monitoring or ranging PERMISSION - CODE

Slide 31

Slide 31 text

CONFIDENTIAL TWO USAGE MODELS M O N I T O R I N G R A N G I N G 2 1

Slide 32

Slide 32 text

Monitoring

Slide 33

Slide 33 text

Passive Receive ENTER and EXIT events Works in the background Can only monitor 20 iBeacons at a time MONITORING

Slide 34

Slide 34 text

MONITORING B ! E N T E R ! E X I T

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

CLRegion

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Ranging

Slide 40

Slide 40 text

Active Continuous callbacks with beacon info (e.g., proximity) No beacon limit Foreground only (kind of) RANGING

Slide 41

Slide 41 text

RANGING B ! R A N G E ( FA R ) R A N G E ( N E A R ) R A N G E ( I M M E D I AT E )

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

CLBeacon

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

CLPROXIMITY

Slide 47

Slide 47 text

CLPROXIMITY

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

CLLOCATIONACCURACY

Slide 50

Slide 50 text

RSSI

Slide 51

Slide 51 text

Is the Distance Accurate?

Slide 52

Slide 52 text

HTTP://STACKOVERFLOW.COM/QUESTIONS/20416218/UNDERSTANDING-IBEACON-DISTANCING

Slide 53

Slide 53 text

HTTPS://SHINESOLUTIONS.COM/2014/02/17/THE-BEACON-EXPERIMENTS-LOW-ENERGY-BLUETOOTH-DEVICES-IN-ACTION/

Slide 54

Slide 54 text

HTTPS://SHINESOLUTIONS.COM/2014/02/17/THE-BEACON-EXPERIMENTS-LOW-ENERGY-BLUETOOTH-DEVICES-IN-ACTION/ DISTANCE EXPERIMENT BLOG POST Looked at two beacon manufacturers Estimate Kontakt Found that accuracy varies between manufacturers and also beacons within a given manufacturer, but distance measures can be decent under certain situations

Slide 55

Slide 55 text

How can I get some iBeacons?

Slide 56

Slide 56 text

HOW MUCH DO THEY COST? E S T I M O T E R A D I U S N E T W O R K S B L U E C AT S 3 F O R $ 5 9 $ 1 4 3 F O R $ 8 7

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

Other Tips

Slide 59

Slide 59 text

Monitoring is allowed Ranging is not However, you can use monitoring to wake your app up, and then range periodically BACKGROUND

Slide 60

Slide 60 text

BEACON IDENTIFICATION If you can’t turn off your beacons, it is good to have some way of disabling them Faraday cage - exist on Amazon

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

MONITORING MORE THAN 20 BEACONS HTTPS://SPIN.ATOMICOBJECT.COM/2016/04/18/MONITORING-OVER-20-IBEACON-REGIONS/