react-native-geolocation
react-native-geolocation copied to clipboard
watchPosition options are not working as expected
I am trying to use watchPosition. I am using Android and I tested with a real device.
const watchId = Geolocation.watchPosition(
position => {
const latitude = position.coords.latitude;
const longitude = position.coords.longitude;
setLatitude(latitude);
setLongitude(longitude);
setSubscriptionId(watchId);
},
error => {
console.log('Error getting location:', error);
},
{distanceFilter: 1, maximumAge: 1000, interval:5000},
);
Even though I change options and option values position is updated only every 20 second regardless distanceFilter and interval values.
I'm not having luck with this function on Android either, feels like I've tried every variation of options. It will get an initial position but it never updates. I ended up updating the position manually with an interval instead.