際際滷

際際滷Share a Scribd company logo
Introduction to
Geolocation & Apples
Maps API

Julian Kr坦l
iOS Software Engineer @ MiQUiDO
!1
Geolocation

How to locate user with the Apples device?

!2
@import CoreLocation


location basis



Standard Locating vs Signi鍖cant change location service



accuracy vs performance



constraints

!3
Accuracy vs Performance
Source

Accuracy

Power

Speed

Celluar

Low

Low

Fast

Wi-Fi

Medium

Medium

Normal

GPS

High

High

Slow

!4
locationManager.desiredAccuracy



kCLLocationAccuracyBestForNavigation



kCLLocationAccuracyBest



kCLLocationAccuracyNearestTenMeters



kCLLocationAccuracyHundredMeters



kCLLocationAccuracyKilometer



kCLLocationAccuracyThreeKilometers

!5
Location Service Constraint


always check availability of the service
([CLLocationManager locationServicesEnabled])



also take a look at authorization status
([CLLocationManager authorizationStatus])



if app requires retrieving location add
UIRequiredDeviceCapabilities key to Info.plist
(value location-services and/or gps)
!6
The Signi鍖cant-Change Location Service



low power way of tracking location changes



requires built-in cellular radio



availability starts from iOS 4

!7
Region Monitoring


you can not monitor in鍖nite number of regions



number of monitored regions is limited for the
app to 20



noti鍖cations on enter and exit region



margin distance before notifying about entering/
exiting a region
!8
Time for code show
Code for this presentation is available on GitHub:
https://github.com/JulianKrol/maps_presentation

!9
Enough! Move one Maps API!

!10
@import MapKit

Add map view to your app and check this out:
mapView.showsUserLocation = YES;

!11
MKAnnotation protocol


coordinate (required)



title (optional)



subtitle (optional)

!12
Almighty
MKOverlayRenderer


draws a visual effect of an overlay it contain
(id<MKOverlay>)



subclasses overrides
drawMapRect:zoomScale:inContext:



has a few subclasses (MKTileOverlayRenderer,
MKOverlayPathRenderer > three more)

!13
Lets travel a bit

!14
More info about Maps


https://developer.apple.com/library/ios/
documentation/userexperience/conceptual/
LocationAwarenessPG/MapKit/MapKit.html



https://www.captechconsulting.com/blog/ericstroh/ios-7-tutorial-series-map-kit



https://developer.apple.com/library/ios/
documentation/userexperience/conceptual/
LocationAwarenessPG/AnnotatingMaps/
AnnotatingMaps.html
!15
For even more involved


Google Maps for iOS https://developers.google.com/maps/
documentation/ios/



MapQuest http://developer.mapquest.com



Spatial database (example) http://postgis.net

!16
Questions?
!17

More Related Content

Introduction to the geolocation & Apple's maps API