51
Android GPS Deep Dive! Na2ve and Browser Andy Gup, Esri www.andygup.net @agup

2013 URISA Track, Android GPS Deep Dive by Andy Gup

Embed Size (px)

DESCRIPTION

This is a must attend session for developers either planning to use or already using Android GPS in your native applications. Android offers one of the most flexible GPS systems that are available in smartphones today. We'll look at key aspects of the Location Manager Class, and provide real-world use cases on how to best implement them. You'll walk away with insight that typically takes days or even weeks to figure out.

Citation preview

Page 1: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Android  GPS  Deep  Dive!  Na2ve  and  Browser  

Andy  Gup,  Esri  www.andygup.net  

@agup  

Page 2: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

I  

GPS  

Page 3: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Who  am  I?  Andy  Gup  Web,  Mobile  Developer  Evangelist    www.andygup.net  github.com/andygup        [email protected]  @agup    

Page 4: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Is  smartphone  GPS  right  for  you?  

 Understanding  use  cases    Understanding  smartphone  GPS!    Deciding  accuracy  thresholds  

Page 5: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Two  open  source  tes2ng  tools  

Page 6: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Android  GPS  Test  Tool  

Page 7: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

HTML5  Geoloca2on  Test  Tool  

Page 8: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Six  types  of  loca2on  data  

Real-­‐2me      GPS    Network  

Cached      GPS    Network  

Passive  NMEA    

Page 9: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Two  types  of  loca2on  data  

 Real-­‐2me      Cached      

Page 10: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Android  SDK  Java  based    Loca2onManager    Loca2on  APIs  

 Significantly  more  control  over    data  providers    baVery  life    offline  usage    when  app  is  minimized  

Page 11: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

HTML5  Geoloca2on  API  

JavaScript-­‐based    Significantly  less  control  over    which  providers  are  used    baVery  life  

 Can’t  be  used  when    minimized    

 

Page 12: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Horizontal  and  ver2cal    Grades:    

Recrea2onal    Map    Survey    High-­‐end  Survey  

 

Accuracy  Requirements  

Page 13: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Horizontal  and  ver2cal    Grades:    

Recrea2onal  >  3  m/10  `*  (Android,  iOS,  iPad,  Garmin,  etc)        Map  1  –  3  meters/3.2  –  9.8  `*    Survey    <  1  m/3.2  `*    High-­‐end  Survey  <  50  cm/1.6  `*  

Accuracy  Requirements  

 *  Approxima2ons  

Page 14: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Horizontal  and  ver2cal    Grades:    

Recrea2onal  -­‐  $    (Android,  iOS,  iPad,  Garmin,  etc)    Map  -­‐  $$    Survey    -­‐  $$$    High-­‐end  Survey  -­‐  $$$$  

Costs  

Page 15: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

   Accuracy  fluctuates…moves  around…!!        

Recrea2onal-­‐grade  accuracy??  

Page 16: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Horizontal  and  ver2cal    

<  1  cm  =  boundary/survey  marker,  gas  line  <  1  m  =    manhole  cover,    1  –  3  meters  =  tree,  trail  head,  junc2on  box,  pothole  3  –  10  meters  =  roo`op,  fire  hydrant  10  –  100  meters  =  parking  lot,  pond  100  –  1000  meters  =  park,  neighborhood  >  1000  meters  =  zip  code  area,  drainage  area  

     

Recrea2onal-­‐grade  accuracy??  

Page 17: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Example  of  accuracy  2ers:    

3  –  10  meters  =  GOOD  10  –  100  meters  =  MAYBE    100  –  1000  meters  =  REJECT  >  1000  meters  =  REJECT  

     

Recrea2onal-­‐grade  accuracy??  

Page 18: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

10  –  100  meters  100  –  1000  meters  >  1000  meters  

     

Smartphone  Accuracy  

Page 19: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Accuracy  

Depends  on  many  things:    Device  type    Which  loca2on  providers  enabled    Wifi  turned  on/off    Cellular  provider    Country            

Page 20: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Accuracy  

GPS  Test  by  ChartCross  

Page 21: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Accuracy  

Depends  on  many  things:    Rural  (open  sky)    Near  a  building    Inside  a  car    Downtown    Indoors          

Higher  accuracy  

Lower  accuracy  

Page 22: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Denver  Pepsi  Center  

Page 23: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

~33  feet/10  meters  (radius)  3422  sq  </314.28  sq.  m  

Page 24: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Image  courtesy  Google  Streetview  

Page 25: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

~99  feet/30  meters  

Page 26: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

328  feet/100  meters  

Page 27: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

~3280  feet/1000  meters  

Page 28: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

GPS:  Cold  vs.  Warm  

versus  

Page 29: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Cold  start  

Phone  rebooted  Updated  phone  OS  Poten2al  for  no  cached  values  Poten2al  for  large  inaccuracy  Has  to  ‘acquire’  the  satellites  

Page 30: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Cold  start  

Page 31: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Cold  Start:  Snapshot  

One-­‐2me  loca2on  >=  minimum  accuracy    Example:  Standing  indoors  ~2  mins  Accuracy  20  meters  

Page 32: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Cold  Start:  Snapshot  

One-­‐2me  loca2on  >=  minimum  accuracy    Example:  Standing  indoors  ~3  mins  Accuracy  3  meters  

Page 33: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Cold  Start:  No  GPS  or  Wifi  

Page 34: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Warm  start  

Cached  loca2ons  available  GPS  has  been  run  recently  

Page 35: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

   Example:  ~4  seconds  Accuracy  11  meters    

Warm  start  

Page 36: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Warm  Start:  GPS  +  Wifi  (downtown)  

Page 37: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Warm:  Accuracy  can  s2ll  fluctuate  

Page 38: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Warm:  Accuracy  can  s2ll  fluctuate  

Page 39: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Warm  or  cold…who  cares??  

 BaVery  life  User  expecta2ons    Leave  GPS  on?  Cycle  GPS  intermiVently?        

Page 40: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

BaVery  life  

Page 41: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

How  to  get  beVer  baVery  life??  

External  baVery  solu2on  examples:      Anker  Astro  Series  (up  to  20,000  mAh)    Energizer  XP  Series  (up  to  18,000  mAh)    Mophie  Juice  (up  to  6,000  mAh)  

 

Page 42: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

How  to  get  beVer  baVery  life??  

Page 43: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

How  to  get  beVer  accuracy??  

External  GPS  receiver  (Wifi,  bluetooth,  plug-­‐in)    Consumer  examples:    Garmin  GLOTM  

 Bad  Elf  GPS    XGPS150A  

   

   

Page 44: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

How  to  get  beVer  accuracy??  

Page 45: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

How  to  get  beVer  accuracy??  

Page 46: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

HTML5  Geoloca2on  Overview  

Limited  control  over  GPS  and  baVery  Cannot  be  minimized  Can  approximate  loca2on  w/o  GPS  Gets  loca2on  faster  when  used  w/  Wifi  Requires  JavaScript  development  experience          

Page 47: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Na2ve  GPS  Overview  

Fine  grained  control  over  GPS  and  baVery  Works  when  minimized  Requires  Java  development  experience          

Page 48: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Collector  for  ArcGIS  

hVp://resources.arcgis.com/en/collector/    

Page 49: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

References  www.gps.gov    hVp://www.andygup.net/android-­‐gps/      Mastering  HTML5  Geoloca2on:  hVps://www.dropbox.com/s/p6940ejtncoedyq/HTML5Geoloca2on%202.pptx      Mastering  Android  GPS:  hVps://www.dropbox.com/s/0fak3oziqyaj7i6/OSCON_MasterAndroidGeoloca2on.pptx      Android  GPS  Test  tool:    hVps://github.com/Esri/android-­‐gps-­‐test-­‐tool      HTML5  Geoloca2on  Test  tool:  hVps://github.com/Esri/html5-­‐geoloca2on-­‐tool-­‐js    

Page 50: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

References  Recrea2onal  vs.  Professional  GPS:    hVp://www.esri.com/news/arcuser/0104/rec-­‐gps.html      Smartphones,  Tables  and  GPS  Accuracy:  hVp://blogs.esri.com/esri/arcgis/2013/07/15/smartphones-­‐tablets-­‐and-­‐gps-­‐accuracy/    

Page 51: 2013 URISA Track, Android GPS Deep Dive by Andy Gup

Ques2ons?  Andy  Gup    Developer  Evangelist    www.andygup.net  github.com/andygup        [email protected]  @agup