title: Start location strategy
body: <p>I am receiving periodically location updates via GPS, the problem is the time until the first location update occurs - it is just to long. When the user is within a building, this time gets even worser.</p>
  
  <p>Therefore I am looking for some strategies to improve the startup time (at the moment I don't use <code>getLastKnownLocation</code> but I will). I started reading <a href="http://android-developers.blogspot.com/search/label/Location">A Deep Dive Into Location</a> to get some ideas and have some thoughts now I would like to discuss with you.</p>
  
  <p>At first the blog post mentioned above goes through each location provider on the device and queries for the <code>getLastKnownLocation</code>, but only considers them when they are not to old and within an allowed accuracy.</p>
  
  <p>Here comes my first question: I would expect to have the network based location immediately available, so I would request a new network based location, then I would get <code>getLastKnownLocation</code> from the GPS-provider and if the last GPS-location is within the circle formed by the point network based location and radius accuracy then I would take the GPS location, regardless how old it is. What do you think?</p>
  
  <p>After checking the last known location I will start the GPS position tracking and because I only need it every 2 seconds and 10m change, I would use
  <code>lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2 * 1000, 10, this);</code></p>
  
  <p>However I found a pattern (inside the presentation <a href="http://www.slideshare.net/retomeier/being-epic-best-practices-for-building-android-apps">Being Epic: Best Practices for Android Development</a> on slide <a href="http://www.slideshare.net/retomeier/being-epic-best-practices-for-building-android-apps/95">95</a> and <a href="http://www.slideshare.net/retomeier/being-epic-best-practices-for-building-android-apps/96">96</a> that at first he turns on coarse and fine locations (with 0,0 for time and distance changes) and then, when the first event is received, he switches to the really needed update frequency. So, does the first gps-update comes faster when the interval is set to 0?</p>
  
  <p>In opposite to this pattern I would keep the coarse update until the first GPS update is received. What do you think?</p>
  
  <p>Hope to get some interesting answers!</p>
  
  <p>----------------Update----------------</p>
  
  <p>I did some investigations: I turned on GPS and waited to get a fix. Then I turned GPS off and drove 50km (31 miles). Then I used the code from <a href="http://android-developers.blogspot.com/search/label/Location">A Deep Dive Into Location</a> to get all the <code>getLastKnownLocation</code>. I tried it twice, first with GPS turned off and second with GPS turned on, but without a fix:</p>
  
  <p>1) with GPS turned off I got<br>
  - Provider: network, correct location with accuracy 680m<br>
  - Provider: passive (mProvider=network), same location as above, same time as above<br>
  - Provider: gps, location null </p>
  
  <p>So I learned that when gps is turned off you get no <code>getLastKnownLocation</code>.</p>
  
  <p>2) with GPS turned on I got<br>
  - Provider: network, correct location with accuracy 652m<br>
  - Provider: passive (mProvider=network), same location as above, same time as above<br>
  - Provider: gps, location as it was 2h earlier with accuracy 12m, time was also 2h earlier</p>
  
  <p>Here I learned that old messages are not invalidated, even it is obvious that they are wrong.</p>
  
  <p>In that case the algorithm works fine, because I moved in the time I turned the GPS off.
  But what if I enter a house? In that case the 2h old GPS result would be very good, even it is outdated.</p>