I use LocationClientto retrieve the user's current location, and I am trying to create LocationRequestwith distance as well as update interval.
My code is currently requesting location updates by update interval:
mLocationRequest = LocationRequest.create();
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
mLocationRequest.setInterval(updateInterval);
mLocationRequest.setFastestInterval(FASTEST_INTERVAL);
if (mLocationClient.isConnected()) {
mLocationClient.requestLocationUpdates(mLocationRequest, this);
}
There LocationManageris a method for requesting location updates for distance.
public void requestLocationUpdates (String provider, long minTime, float minDistance, LocationListener listener)
source
share