title: how to get GPS location once and without automatic updates?
body: <p>i am using following code to get GPS location.
  now i want to get GPS location without automatic updates.</p>
  
  <p>for example i want to get latest location on button click only once not all the time.</p>
  
  <p>so please tell what value should i use for minTime and Distancewhile getting location updates for once and without intervals and automatic updates?</p>
  
  <p>and should i call location updates in that button instead of onResume ?</p>
  
  <pre><code>onbutton click() {
    mlocManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    Criteria criteria = new Criteria();
    bestProvider = mlocManager.getBestProvider(criteria, false);
    loc = mlocManager.getLastKnownLocation(bestProvider);
  
    if(loc != null) {
      MyDeviceLatitude = loc.getLatitude();
      MyDeviceLongitude = loc.getLongitude();
    } else {
      showError();
    }    
  }
  
  @Override
  public void onLocationChanged(Location argLocation) {
    if (argLocation != null) {
      loc = argLocation;
    }
  }
  
  @Override
  protected void onPause() {
    super.onPause();
    mlocManager.removeUpdates(this);
  }
  
  @Override
  protected void onResume() {
    super.onResume();
    Criteria criteria = new Criteria();
    mlocManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    bestProvider = mlocManager.getBestProvider(criteria, false);
    mlocManager.requestLocationUpdates(bestProvider, 20000,1 , this); 
  }
  </code></pre>
  
  <p>any help would be appreciated.</p>