SlideShare a Scribd company logo
1 of 23
Download to read offline
Working with the
iOS Core Location Framework
and Google Maps SDK
Lecture 10
Jonathan R. Engelsma
TOPICS
• The Fundamentals.
• Working with CoreLocation
• Working with Google Maps SDK
THE CURRENT LOCATION
• The ability to obtain the device’s
current location is a very powerful
feature!
• Enabler for context aware
computing
• App integrates content and
behavior relevant to current
location
OBTAININGTHE LOCATION
• Smartphones use a variety of
techniques to locate the device:
• GPS
• Assisted GPS
• Cellular / WiFiTriangulation
GLOBAL POSITIONING
SYSTEM
• Space-based satellite system (US Government)
• Requires line of sight to 4+ satellites
• Accuracy: ~ 3 - 15 meters.
• Can take time to get first fix.
• Don’t work well indoors.
ASSISTED GPS
• Greatly reduces theTTFF (time to first fix).
• Uses terrestrial radio network to accelerate connection to
satellite.
• Widely used by modern cell phones.
WIFI / CELLULAR
TRIANGULATION
• Uses terrestrial cellular
towers and wifi access
points to determine device
location.
• Can be used indoors!
OBTAININGTHE LOCATION
• Implication: Location data varies in accuracy.
Accurate Less Accurate
TAKES ENERGY!
• Getting a GEO fix takes a
lot of battery!
• device can’t sleep when
GPS receiver is running.
• make sure your apps
don’t misuse or you will
get uninstalled real fast!
CORE LOCATION
• CoreLocation Framework
• Provides apps with location coordinate and heading info.
• Can define geographical regions and monitor when user
crosses region boundaries.
• Also supports “beacon” regions with iBeacon devices.
LOCATION MANAGER
• CLLocationManager:
var locationManager = CLLocationManager()
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.distanceFilter = 10.0
Determine how far the device must travel
before a new location update is generated.
LOCATION ACCURACY
Accuracy Technology
kCLLocationAccuracyBestForNavigation GPS
kCLLocationAccuracyBest GPS
kCLLocationAccuracyNearestTenMeters GPS
kCLLocationAccuracyHundredMeters
WiFi (GPS in rural
areas)
kCLLocationAccuracyKilometer Cell tower
kCLLocationAccuracyThreeKilometers Cell tower
LOCATION MANAGER
• CLLocationManager requires location updates asynchronously.
• View Controller typically implements the
CLLocationManagerDelegate protocol to receive these
updates.
LOCATION MANAGER
DELEGATE
func locationManager(manager: CLLocationManager!,
didChangeAuthorizationStatus status: CLAuthorizationStatus)
{
// called when authorization changes.
}
func locationManagerDidResumeLocationUpdates(manager: CLLocationManager!) {
// called when location updates start to arrive.
}
LOCATION MANAGER
DELEGATE
func locationManager(manager: CLLocationManager!,
didUpdateLocations locations: [AnyObject]!)
{
var location: CLLocation = locations.first as! CLLocation
// put code to handle location update here.
}
CLLOCATION
• CLLocation: represents the data generated by
CLLocationManager. It contains:
• geo coordinates and altitude
• accuracy indicator
• time
• speed and heading.
GEO CODING
• CLGeocoder: converts between a lat/long coordinate and a
user-friendly representation of that coordinate.
Lat: 42.963661
Long: -85.677515
Grand Rapids, MI
USA
reverse geo-coding
forward geo-coding
GEO-CODING GUIDELINES
• Geocoder requests involve the network and are rate limited:
• send one request per user action.
• cache the results if you do more than one action per loc.
• issue a new geocoding request only if user has moved a
significant distance.
• don’t use it in the background!
GOOGLE MAPS SDK
• Google Maps SDK is the alternative of
choice for Apple MapKit!
• Provides more detailed map tiles.
• Includes StreetView!
• Can optionally use Apple’s MapKit
framework
https://developers.google.com/maps/documentation/ios/intro
GOOGLE MAPS SDK
• Types: Normal, Satellite, Hybrid,Terrain
• Traffic Layer
• Indoor building maps where available. (Museum navigator!)
• Places API / Place Picker
• Panorama (StreetView)
• Interactive Markers
• Polygons
• Camera view animation
DISPLAY MODES
Standard Satellite StreetView
CREATING A MAPVIEW
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.requestWhenInUseAuthorization()
var cameraAllendale = GMSCameraPosition.cameraWithLatitude(42.96356,
longitude: -85.8899, zoom: 14.7)
mapView = GMSMapView.mapWithFrame(CGRectZero, camera: cameraAllendale)
mapView.settings.compassButton = true
self.view = mapView
let marker = GMSMarker()
marker.position = CLLocationCoordinate2DMake(42.96356, -85.8899)
marker.title = "GVSU"
marker.snippet = "Allendale, MI"
marker.icon = UIImage(named: "gvsu")
marker.appearAnimation = kGMSMarkerAnimationPop
marker.map = mapView
}
READING ASSIGNMENT
• Chapter 21 in Programming iOS8 by Neuburg
• Google Map SDK Documentation / Example Code
• https://developers.google.com/maps/documentation/ios/

More Related Content

More from Jonathan Engelsma

Knowing Your Bees: Becoming a Better Beekeeper
Knowing Your Bees: Becoming a Better BeekeeperKnowing Your Bees: Becoming a Better Beekeeper
Knowing Your Bees: Becoming a Better BeekeeperJonathan Engelsma
 
BIP Hive Scale Program Overview
BIP Hive Scale Program OverviewBIP Hive Scale Program Overview
BIP Hive Scale Program OverviewJonathan Engelsma
 
Selling Honey at Farmers Markets, Expos, etc.
Selling Honey at Farmers Markets, Expos, etc. Selling Honey at Farmers Markets, Expos, etc.
Selling Honey at Farmers Markets, Expos, etc. Jonathan Engelsma
 
Harvesting and Handling Honey for Hobby and Small Sideline Beekeepers
Harvesting and Handling Honey for Hobby and Small Sideline BeekeepersHarvesting and Handling Honey for Hobby and Small Sideline Beekeepers
Harvesting and Handling Honey for Hobby and Small Sideline BeekeepersJonathan Engelsma
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)Jonathan Engelsma
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 09)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 09)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 09)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 09)Jonathan Engelsma
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 06)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 06)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 06)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 06)Jonathan Engelsma
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)Jonathan Engelsma
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 04)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 04)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 04)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 04)Jonathan Engelsma
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03) iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03) Jonathan Engelsma
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02) iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02) Jonathan Engelsma
 
So You Want To Be a Beekeeper?
So You Want To Be a Beekeeper? So You Want To Be a Beekeeper?
So You Want To Be a Beekeeper? Jonathan Engelsma
 
What Every IT Manager Should Know About Mobile Apps
What Every IT Manager Should Know About Mobile AppsWhat Every IT Manager Should Know About Mobile Apps
What Every IT Manager Should Know About Mobile AppsJonathan Engelsma
 
2013 Michigan Beekeepers Association Annual Spring Conference
2013 Michigan Beekeepers Association Annual Spring Conference2013 Michigan Beekeepers Association Annual Spring Conference
2013 Michigan Beekeepers Association Annual Spring ConferenceJonathan Engelsma
 
2012 Michigan Beekeepers Association Annual Spring Conference - Beekeepers On...
2012 Michigan Beekeepers Association Annual Spring Conference - Beekeepers On...2012 Michigan Beekeepers Association Annual Spring Conference - Beekeepers On...
2012 Michigan Beekeepers Association Annual Spring Conference - Beekeepers On...Jonathan Engelsma
 

More from Jonathan Engelsma (17)

Knowing Your Bees: Becoming a Better Beekeeper
Knowing Your Bees: Becoming a Better BeekeeperKnowing Your Bees: Becoming a Better Beekeeper
Knowing Your Bees: Becoming a Better Beekeeper
 
BIP Hive Scale Program Overview
BIP Hive Scale Program OverviewBIP Hive Scale Program Overview
BIP Hive Scale Program Overview
 
Selling Honey Online
Selling Honey OnlineSelling Honey Online
Selling Honey Online
 
Selling Honey at Farmers Markets, Expos, etc.
Selling Honey at Farmers Markets, Expos, etc. Selling Honey at Farmers Markets, Expos, etc.
Selling Honey at Farmers Markets, Expos, etc.
 
Harvesting and Handling Honey for Hobby and Small Sideline Beekeepers
Harvesting and Handling Honey for Hobby and Small Sideline BeekeepersHarvesting and Handling Honey for Hobby and Small Sideline Beekeepers
Harvesting and Handling Honey for Hobby and Small Sideline Beekeepers
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 09)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 09)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 09)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 09)
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 06)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 06)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 06)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 06)
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 04)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 04)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 04)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 04)
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03) iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 03)
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02) iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 02)
 
So You Want To Be a Beekeeper?
So You Want To Be a Beekeeper? So You Want To Be a Beekeeper?
So You Want To Be a Beekeeper?
 
What Every IT Manager Should Know About Mobile Apps
What Every IT Manager Should Know About Mobile AppsWhat Every IT Manager Should Know About Mobile Apps
What Every IT Manager Should Know About Mobile Apps
 
Mobile Gamification
Mobile GamificationMobile Gamification
Mobile Gamification
 
2013 Michigan Beekeepers Association Annual Spring Conference
2013 Michigan Beekeepers Association Annual Spring Conference2013 Michigan Beekeepers Association Annual Spring Conference
2013 Michigan Beekeepers Association Annual Spring Conference
 
2012 Michigan Beekeepers Association Annual Spring Conference - Beekeepers On...
2012 Michigan Beekeepers Association Annual Spring Conference - Beekeepers On...2012 Michigan Beekeepers Association Annual Spring Conference - Beekeepers On...
2012 Michigan Beekeepers Association Annual Spring Conference - Beekeepers On...
 

Recently uploaded

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Recently uploaded (20)

Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 10)

  • 1. Working with the iOS Core Location Framework and Google Maps SDK Lecture 10 Jonathan R. Engelsma
  • 2. TOPICS • The Fundamentals. • Working with CoreLocation • Working with Google Maps SDK
  • 3. THE CURRENT LOCATION • The ability to obtain the device’s current location is a very powerful feature! • Enabler for context aware computing • App integrates content and behavior relevant to current location
  • 4. OBTAININGTHE LOCATION • Smartphones use a variety of techniques to locate the device: • GPS • Assisted GPS • Cellular / WiFiTriangulation
  • 5. GLOBAL POSITIONING SYSTEM • Space-based satellite system (US Government) • Requires line of sight to 4+ satellites • Accuracy: ~ 3 - 15 meters. • Can take time to get first fix. • Don’t work well indoors.
  • 6. ASSISTED GPS • Greatly reduces theTTFF (time to first fix). • Uses terrestrial radio network to accelerate connection to satellite. • Widely used by modern cell phones.
  • 7. WIFI / CELLULAR TRIANGULATION • Uses terrestrial cellular towers and wifi access points to determine device location. • Can be used indoors!
  • 8. OBTAININGTHE LOCATION • Implication: Location data varies in accuracy. Accurate Less Accurate
  • 9. TAKES ENERGY! • Getting a GEO fix takes a lot of battery! • device can’t sleep when GPS receiver is running. • make sure your apps don’t misuse or you will get uninstalled real fast!
  • 10. CORE LOCATION • CoreLocation Framework • Provides apps with location coordinate and heading info. • Can define geographical regions and monitor when user crosses region boundaries. • Also supports “beacon” regions with iBeacon devices.
  • 11. LOCATION MANAGER • CLLocationManager: var locationManager = CLLocationManager() locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.distanceFilter = 10.0 Determine how far the device must travel before a new location update is generated.
  • 12. LOCATION ACCURACY Accuracy Technology kCLLocationAccuracyBestForNavigation GPS kCLLocationAccuracyBest GPS kCLLocationAccuracyNearestTenMeters GPS kCLLocationAccuracyHundredMeters WiFi (GPS in rural areas) kCLLocationAccuracyKilometer Cell tower kCLLocationAccuracyThreeKilometers Cell tower
  • 13. LOCATION MANAGER • CLLocationManager requires location updates asynchronously. • View Controller typically implements the CLLocationManagerDelegate protocol to receive these updates.
  • 14. LOCATION MANAGER DELEGATE func locationManager(manager: CLLocationManager!, didChangeAuthorizationStatus status: CLAuthorizationStatus) { // called when authorization changes. } func locationManagerDidResumeLocationUpdates(manager: CLLocationManager!) { // called when location updates start to arrive. }
  • 15. LOCATION MANAGER DELEGATE func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) { var location: CLLocation = locations.first as! CLLocation // put code to handle location update here. }
  • 16. CLLOCATION • CLLocation: represents the data generated by CLLocationManager. It contains: • geo coordinates and altitude • accuracy indicator • time • speed and heading.
  • 17. GEO CODING • CLGeocoder: converts between a lat/long coordinate and a user-friendly representation of that coordinate. Lat: 42.963661 Long: -85.677515 Grand Rapids, MI USA reverse geo-coding forward geo-coding
  • 18. GEO-CODING GUIDELINES • Geocoder requests involve the network and are rate limited: • send one request per user action. • cache the results if you do more than one action per loc. • issue a new geocoding request only if user has moved a significant distance. • don’t use it in the background!
  • 19. GOOGLE MAPS SDK • Google Maps SDK is the alternative of choice for Apple MapKit! • Provides more detailed map tiles. • Includes StreetView! • Can optionally use Apple’s MapKit framework https://developers.google.com/maps/documentation/ios/intro
  • 20. GOOGLE MAPS SDK • Types: Normal, Satellite, Hybrid,Terrain • Traffic Layer • Indoor building maps where available. (Museum navigator!) • Places API / Place Picker • Panorama (StreetView) • Interactive Markers • Polygons • Camera view animation
  • 22. CREATING A MAPVIEW override func viewDidLoad() { super.viewDidLoad() locationManager.delegate = self locationManager.requestWhenInUseAuthorization() var cameraAllendale = GMSCameraPosition.cameraWithLatitude(42.96356, longitude: -85.8899, zoom: 14.7) mapView = GMSMapView.mapWithFrame(CGRectZero, camera: cameraAllendale) mapView.settings.compassButton = true self.view = mapView let marker = GMSMarker() marker.position = CLLocationCoordinate2DMake(42.96356, -85.8899) marker.title = "GVSU" marker.snippet = "Allendale, MI" marker.icon = UIImage(named: "gvsu") marker.appearAnimation = kGMSMarkerAnimationPop marker.map = mapView }
  • 23. READING ASSIGNMENT • Chapter 21 in Programming iOS8 by Neuburg • Google Map SDK Documentation / Example Code • https://developers.google.com/maps/documentation/ios/