Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 56b53dd

Browse files
committed
Adding updateDistance option for Android
1 parent 3da7593 commit 56b53dd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ geolocation.getCurrentLocation({ desiredAccuracy: Accuracy.high, maximumAge: 500
6969
| Property | Default | Description |
7070
| --- | --- | --- |
7171
| 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. |
72-
| 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) |
72+
| 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)) |
7373
| 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)).|
7474
| 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)).|
7575
| maximumAge | - | How old locations to receive in ms. |

src/geolocation.android.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ function _getLocationRequest(options: Options): any {
104104
let minUpdateTime = options.minimumUpdateTime === 0 ?
105105
0 : options.minimumUpdateTime || Math.min(updateTime, fastestTimeUpdate);
106106
mLocationRequest.setFastestInterval(minUpdateTime);
107+
if (options.updateDistance)
108+
mLocationRequest.setSmallestDisplacement(options.updateDistance);
107109
if (options.desiredAccuracy === Accuracy.high) {
108110
mLocationRequest.setPriority(com.google.android.gms.location.LocationRequest.PRIORITY_HIGH_ACCURACY);
109111
} else {

0 commit comments

Comments
 (0)