title: Android - Location Manager requestLocationUpdates bottleneck
body: <p>I have an Android background service that report positions from time to time. When I test locally over wifi it works pretty well, however when testing in 3G connection for example (sometimes on Edge) I have perceived that the application apparently enters in a bottleneck and do not execute the <strong><em>onLocationChanged</em></strong> method. That's okay because maybe lost signal or so on. However after a while (maybe when connection is re-established) it start updating all requests at once, in a matter of a few seconds many many times the method <strong><em>onLocationChanged</em></strong> is executed. </p>
  
  <p>Does anyone have ideas how to solve that? Is it possible to add timeout into the method <strong>locationManager.requestLocationUpdates</strong>?</p>
  
  <p><strong>My Listener</strong></p>
  
  <pre><code>public class MyListener implements LocationListener {
    @Override
    public void onLocationChanged(Location loc) {
          //report location to server
          HttlCallToUpdatePostion(loc.Latitude, loc.Longitude, loc.Accuracy);
    }
  }
  </code></pre>
  
  <p><strong>My Service</strong></p>
  
  <pre><code>Handler handler = null;
  LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
  MyListener listener = new MyListener();
  
  protected void doWork() {
    Looper.prepare();
    handler = new Handler();
    locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 5000, listener);
    Looper.loop();
  }
  </code></pre>