diff --git a/README.md b/README.md index 338ecc2..ac1a026 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ geolocation.getCurrentLocation({ desiredAccuracy: Accuracy.high, maximumAge: 500 | Property | Default | Description | | --- | --- | --- | | desiredAccuracy? | Accuracy.high | This will return the finest location available but use more power than `any` option. `Accuracy.any` is considered to be about 100 meter accuracy. Using a coarse accuracy such as this often consumes less power. | -| updateDistance | iOS - no filter | Update distance filter in meters. Specifies how often to update the location (ignored on Android). Read more in [Apple document](https://developer.apple.com/documentation/corelocation/cllocationmanager/1423500-distancefilter?language=objc) | +| updateDistance | No filter | Update distance filter in meters. Specifies how often to update the location. Read more in [Apple document](https://developer.apple.com/documentation/corelocation/cllocationmanager/1423500-distancefilter?language=objc) and/or [Google documents](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#setSmallestDisplacement(float)) | | updateTime | 1 minute | Interval between location updates, in milliseconds (ignored on iOS). Read more in [Google document](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest#setInterval(long)).| | minimumUpdateTime | 5 secs | Minimum time interval between location updates, in milliseconds (ignored on iOS). Read more in [Google document](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest#setFastestInterval(long)).| | maximumAge | - | How old locations to receive in ms. | diff --git a/src/geolocation.android.ts b/src/geolocation.android.ts index 4dab24d..a068119 100644 --- a/src/geolocation.android.ts +++ b/src/geolocation.android.ts @@ -104,6 +104,9 @@ function _getLocationRequest(options: Options): any { let minUpdateTime = options.minimumUpdateTime === 0 ? 0 : options.minimumUpdateTime || Math.min(updateTime, fastestTimeUpdate); mLocationRequest.setFastestInterval(minUpdateTime); + if (options.updateDistance) { + mLocationRequest.setSmallestDisplacement(options.updateDistance); + } if (options.desiredAccuracy === Accuracy.high) { mLocationRequest.setPriority(com.google.android.gms.location.LocationRequest.PRIORITY_HIGH_ACCURACY); } else { diff --git a/src/location-monitor.d.ts b/src/location-monitor.d.ts index 42af45b..278dc82 100644 --- a/src/location-monitor.d.ts +++ b/src/location-monitor.d.ts @@ -10,7 +10,7 @@ export interface Options { desiredAccuracy?: number; /** - * Update distance filter in meters. Specifies how often to update. Default on iOS is no filter (ignored on Android) + * Update distance filter in meters. Specifies how often to update. Default is no filter */ updateDistance?: number;