Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
3 changes: 3 additions & 0 deletions src/geolocation.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/location-monitor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down