i am using following code to get GPS location. now i want to get GPS location without automatic updates.
for example i want to get latest location on button click only once not all the time.
so please tell what value should i use for minTime and Distancewhile getting location updates for once and without intervals and automatic updates?
and should i call location updates in that button instead of onResume ?
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); 
}
any help would be appreciated.