title: Android - Getting Network GPS location within a short time frame (10 seconds max)
body: <p>I'm trying to set up a quick and dirty GPS lookup via LocationManager which fetches a network location (within 500 meters) every half second for ten seconds. In other words, I'm just trying to find the correct coarse Criteria settings and the correct logic to stop checking after 10 seconds of no better locations within my Handler thread.</p>
  
  <p>I'm thinking my main loop should look something like this:</p>
  
  <pre><code>/**
   * Iteration step time.
   */
  private static final int ITERATION_TIMEOUT_STEP = 500; //half-sec intervals
  public void run(){
      boolean stop = false;
      counts++;
      if(DEBUG){
          Log.d(TAG, "counts=" + counts);
      }
  
      //if timeout (10 secs) exceeded, stop tying
      if(counts &gt; 20){ 
          stop = true;
      }
  
      //location from my listener
      if(bestLocation != null){
         //remove all network and handler callbacks
      } else {
         if(!stop){
            handler.postDelayed(this, ITERATION_TIMEOUT_STEP);
         } else {
            //remove callbacks
         }
      }
  }
  </code></pre>
  
  <p>What I want to know is after I fetch the last known location as my initial best location and kick off my thread, how do I set up the coarse criteria so that I receive a more accurate one than the initial one (in order to compare the two for freshness), which is usually diametrically different from my current location?</p>