react-native-geolocation icon indicating copy to clipboard operation
react-native-geolocation copied to clipboard

watchPosition options are not working as expected

Open MelihaDuman opened this issue 1 year ago • 1 comments

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.

MelihaDuman avatar Jan 10 '24 15:01 MelihaDuman

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.

gaspop avatar Jan 20 '24 15:01 gaspop