101
© 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. #WWDC14 Taking Core Location Indoors Session 708 Nav Patel Software Engineer Core OS

IOS 8 Indoor Location

Embed Size (px)

DESCRIPTION

Indoor location in iOS 8

Citation preview

Page 1: IOS 8 Indoor Location

© 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.

#WWDC14

Taking Core Location Indoors

Session 708 Nav Patel Software Engineer

Core OS

Page 2: IOS 8 Indoor Location

Overview

Indoor Positioning

How do you use it?

Indoor Positioning and iBeacon Technology

Next steps

Page 3: IOS 8 Indoor Location

Today’s TechnologyCellular, GPS, Wi-Fi

Page 4: IOS 8 Indoor Location

Today’s TechnologyCellular

Area in a city

Low power

Always available

Page 5: IOS 8 Indoor Location

Today’s TechnologyGPS

Accurate enough for navigation

Available globally

Less accurate in urban canyons

Page 6: IOS 8 Indoor Location

Today’s TechnologyWi-Fi

Within a city block

Augments GPS positioning

Wi-Fi only devices

Page 7: IOS 8 Indoor Location

Existing Location

Navigation outdoors

Works well globally

Page 8: IOS 8 Indoor Location

Problem

Not great indoors

Altitude, not floor

Page 9: IOS 8 Indoor Location

Indoor Positioning

Page 10: IOS 8 Indoor Location

Playback Speed 10x

Page 11: IOS 8 Indoor Location

Indoor Positioning

RF Parametric data

Motion sensors

Page 12: IOS 8 Indoor Location

How Does It All Work?Getting indoors

Cell

GPS

Wi-Fi

Page 13: IOS 8 Indoor Location

How Does It All Work?Getting indoors

Location Fix

Wi-FiGPSCell Motion

Page 14: IOS 8 Indoor Location

How Does It All Work?Getting indoors

Location Fix

Wi-FiGPSCell Motion

Page 15: IOS 8 Indoor Location

How Does It All Work?Getting indoors

Location FixIndoor Location Fix

Wi-FiGPSCell Motion

Page 16: IOS 8 Indoor Location

Why Indoors?

Page 17: IOS 8 Indoor Location

Why Indoors?

Directories

Page 18: IOS 8 Indoor Location

Why Indoors?

Directories

Venue maps

Page 19: IOS 8 Indoor Location

Why Indoors?

Directories

Venue maps

Some interactivity

Page 20: IOS 8 Indoor Location

Why Indoors?Location is context

Page 21: IOS 8 Indoor Location

Why Indoors?Location is context

Way-finding

Page 22: IOS 8 Indoor Location

Why Indoors?Location is context

Page 23: IOS 8 Indoor Location

Find each other

Why Indoors?Location is context

Page 24: IOS 8 Indoor Location

Find each other

Find you

Why Indoors?Location is context

Page 25: IOS 8 Indoor Location

Why Indoors?Location is context

Page 26: IOS 8 Indoor Location

Why Indoors?Location is context

Last piece of the puzzle

Page 27: IOS 8 Indoor Location

How Do You Use It? Core Location

Page 28: IOS 8 Indoor Location

How Do You Use It? Core Location

Wi-Fi on, device unlocked

Page 29: IOS 8 Indoor Location

How Do You Use It? Core Location

Wi-Fi on, device unlocked

Exact same Core Location API

Page 30: IOS 8 Indoor Location

How Do You Use It? Core Location

Wi-Fi on, device unlocked

Exact same Core Location API

Floor number

Page 31: IOS 8 Indoor Location

How Do You Use It? CLFloor

Page 32: IOS 8 Indoor Location

How Do You Use It? CLFloor

@property(readonly, nonatomic, copy) CLFloor *floor !

@interface CLFloor @property(readonly, nonatomic) NSInteger level; @end

Page 33: IOS 8 Indoor Location

Building an Indoor ApplicationOvercoming spherical coordinate challenges

Vitali Lovich

Page 34: IOS 8 Indoor Location

Geographic Coordinate System

Latitude/longitude

Common

Convenient

Difficult to work with

Page 35: IOS 8 Indoor Location

Floorplan Image

Easy for display

Convenient graphical coordinates

Display coordinate frame

Page 36: IOS 8 Indoor Location

Conversion

Three coordinate frames to consider

Watch out for spherical distortion

Page 37: IOS 8 Indoor Location

Conversion

Three coordinate frames to consider

Watch out for spherical distortion

Page 38: IOS 8 Indoor Location

Helper Functions

MKMapPointForCoordinate

MKMetersBetweenMapPoints

MKMetersPerMapPointAtLatitude

CGAffineTransformMakeScale

CGAffineTransformMakeRotation

CGPointApplyAffineTransform

Page 39: IOS 8 Indoor Location

Required Data

Two anchor points

Anchor point = latitude/longitude + floorplan pixels

Page 40: IOS 8 Indoor Location

Scale

We need pixelsPerMeter • P2 = MKMapPointForCoordinate(A1.Geo)

• P1 = MKMapPointForCoordinate(A2.Geo)

• MKMetersBetweenMapPoints(P1, P2)

!

hypot(A2.Pixels.x - A1.Pixels.x, A2.Pixels.y - A2.Pixels.y)

Page 41: IOS 8 Indoor Location

Orientation

XYSouth

East

X

YSouth

East

Page 42: IOS 8 Indoor Location

Conversion

XYSouth

East

Page 43: IOS 8 Indoor Location

Conversion

XYSouth

East

Page 44: IOS 8 Indoor Location

Conversion

XYSouth East

Page 45: IOS 8 Indoor Location

XY

Conversion

South East

Page 46: IOS 8 Indoor Location

Conversion

South East XY

Page 47: IOS 8 Indoor Location

Conversion

South East XY

θg

θf

θr = θf - θg

Page 48: IOS 8 Indoor Location

Putting It Together

Pointuser = MKMapPointForCoordinate(UserPosition)

MetersScale = MKMetersPerMapPointAtLatitude(A1.Geo)

Metersuser = (Pointuser - PointA1) * MetersScale

CGPointApplyAffineTransform(Metersuser, CGAffineTransformMakeScale(Pixels/Meter))

CGPointApplyAffineTransform(Pixelsuser, CGAffineTransformMakeRotation(θr))

Page 49: IOS 8 Indoor Location

AvailabilityComing soon

Page 50: IOS 8 Indoor Location

AvailabilityComing soon

California Academy of Sciences, San Francisco

Westfield San Francisco Centre, San Francisco

Mineta San Jose International Airport, San Jose

Page 51: IOS 8 Indoor Location

Discover Your App

Page 52: IOS 8 Indoor Location

Discover Your App

Advertise at your venue

Page 53: IOS 8 Indoor Location

Discover Your App

Advertise at your venue

App Store—Near Me

Page 54: IOS 8 Indoor Location

Discover Your App

Advertise at your venue

App Store—Near Me

Continuity

Page 55: IOS 8 Indoor Location

Discover Your App

Advertise at your venue

App Store—Near Me

Continuity

Page 56: IOS 8 Indoor Location

Indoor Positioning and iBeacon TechnologyPosition and proximity

Page 57: IOS 8 Indoor Location

iBeacon TechnologyReview

iBeacon Technology

Page 58: IOS 8 Indoor Location

Indoor Positioning iBeacon Technology

Position Proximity

Navigation Notification

Page 59: IOS 8 Indoor Location

Art Gallery Example

Page 60: IOS 8 Indoor Location

Art Gallery ExampleRegion entrance

CLCircularRegion

Page 61: IOS 8 Indoor Location

Art Gallery ExampleRegion entrance

CLCircularRegion

Page 62: IOS 8 Indoor Location

Art Gallery ExampleRegion entrance

CLCircularRegion

Page 63: IOS 8 Indoor Location

Art Gallery ExampleRegion entrance

Page 64: IOS 8 Indoor Location

Art Gallery ExampleRegion entrance

Page 65: IOS 8 Indoor Location

Art Gallery ExampleBeacon regions

Page 66: IOS 8 Indoor Location
Page 67: IOS 8 Indoor Location
Page 68: IOS 8 Indoor Location
Page 69: IOS 8 Indoor Location
Page 70: IOS 8 Indoor Location

Art Gallery ExampleBeacon at entrance—Region monitoring

[self.locationManager startMonitoringForRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region

Page 71: IOS 8 Indoor Location

Art Gallery ExampleBeacon at entrance—Region monitoring

[self.locationManager startMonitoringForRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region

Page 72: IOS 8 Indoor Location

Art Gallery ExampleBeacon at entrance—Region monitoring

[self.locationManager startMonitoringForRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region

Page 73: IOS 8 Indoor Location

Art Gallery ExampleBeacon at entrance—Region monitoring

[self.locationManager startMonitoringForRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region

Page 74: IOS 8 Indoor Location

Art Gallery ExampleNavigation and commentary

Page 75: IOS 8 Indoor Location

Display user position on map

Art Gallery ExampleNavigation and commentary

Page 76: IOS 8 Indoor Location

Display user position on map

Art Gallery ExampleNavigation and commentary

Page 77: IOS 8 Indoor Location

Display user position on map

Navigate

Art Gallery ExampleNavigation and commentary

Page 78: IOS 8 Indoor Location

Display user position on map

Navigate

Art Gallery ExampleNavigation and commentary

Page 79: IOS 8 Indoor Location

Display user position on map

Navigate

Art Gallery ExampleNavigation and commentary

Page 80: IOS 8 Indoor Location

Display user position on map

Navigate

Relevant content based on exhibits nearby

Art Gallery ExampleNavigation and commentary

Page 81: IOS 8 Indoor Location

Art Gallery ExampleProximity to exhibits

Page 82: IOS 8 Indoor Location

Art Gallery ExampleProximity to exhibits

Page 83: IOS 8 Indoor Location

Art Gallery ExampleProximity to exhibits

Page 84: IOS 8 Indoor Location

Art Gallery ExampleProximity to exhibits

Page 85: IOS 8 Indoor Location

Art Gallery ExampleProximity to exhibits

Page 86: IOS 8 Indoor Location

Art Gallery ExampleProximity to exhibits

Page 87: IOS 8 Indoor Location

Art Gallery ExampleProximity to exhibits

Page 88: IOS 8 Indoor Location

Art Gallery ExampleBeacon at exhibit—Proximity

[self.locationManager startRangingBeaconsInRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region !

beacon.proximity !

beacon.major !

beacon.minor !

Page 89: IOS 8 Indoor Location

Art Gallery ExampleBeacon at exhibit—Proximity

[self.locationManager startRangingBeaconsInRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region !

beacon.proximity !

beacon.major !

beacon.minor !

Page 90: IOS 8 Indoor Location

Art Gallery ExampleBeacon at exhibit—Proximity

[self.locationManager startRangingBeaconsInRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region !

beacon.proximity !

beacon.major !

beacon.minor !

Page 91: IOS 8 Indoor Location

Art Gallery ExampleBeacon at exhibit—Proximity

[self.locationManager startRangingBeaconsInRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region !

beacon.proximity !

beacon.major !

beacon.minor !

Page 92: IOS 8 Indoor Location

Art Gallery ExampleBeacon at exhibit—Proximity

[self.locationManager startRangingBeaconsInRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region !

beacon.proximity !

beacon.major !

beacon.minor !

Page 93: IOS 8 Indoor Location

Art Gallery ExampleBeacon at exhibit—Proximity

[self.locationManager startRangingBeaconsInRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region !

beacon.proximity !

beacon.major !

beacon.minor !

Page 94: IOS 8 Indoor Location

Art Gallery ExampleBeacon at exhibit—Proximity

[self.locationManager startRangingBeaconsInRegion:beaconRegion]; !

- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region !

beacon.proximity !

beacon.major !

beacon.minor !

Page 95: IOS 8 Indoor Location

With Great PowerStrict security and privacy guidelines

Request location only as you need it

When In Use authorization

Have a clear purpose string

Page 96: IOS 8 Indoor Location

Next StepsSign up

Maps Connect Indoor Positioning—Sign up http://mapsconnect.apple.com

Maps Maps & Core Location API http://developer.apple.com/maps

iBeacon iBeacon Technology & Licensing http://developer.apple.com/ibeacon

Page 97: IOS 8 Indoor Location

SummaryIndoor Positioning

Precise Indoor Positioning

Core Location APIs

Indoor Positioning and iBeacon Technology

Page 98: IOS 8 Indoor Location

More Information

Craig Keithley MFi and I/O Technologies Evangelist [email protected]

Documentation Location and Maps Programming Guide http://developer.apple.com

Apple Developer Forums http://devforums.apple.com

Page 99: IOS 8 Indoor Location

Related Sessions

• What’s New in Core Location Marina Tuesday 2:00PM

• User Privacy in iOS and OS X Nob Hill Thursday 2:00PM

Page 100: IOS 8 Indoor Location

Labs

• Core Location Lab Core OS Lab B Thursday 12:45PM

Page 101: IOS 8 Indoor Location