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

Speed value returns -1 and 0

Open MRadek55 opened this issue 2 years ago • 3 comments

Hey everyone!

I have encountered a problem with speed and heading from watchPosition listener

  useEffect(() => {
    const watchId = Geolocation.watchPosition(({ coords }) => {
      const { latitude: lat, longitude: lng } = coords;
      setCurrentLocation({ lat, lng });
    }, (err) => console.log(err), {
      enableHighAccuracy: true,
    });

    return () => {
      Geolocation.clearWatch(watchId);
    };
  }, []);

The lng and lat values work fine, but the two above are 0 (on Android) and -1 (for iOS) for speed and -1 for heading.

I'm using fake GPS for Android while testing and prepared GPX file for iOS

Thanks in advance!

MRadek55 avatar Feb 06 '23 11:02 MRadek55

@MRadek55 have you found a solution for this? I`m facing the same issue

matheusyuri7 avatar Mar 21 '23 11:03 matheusyuri7

@MRadek55 have you found a solution for this? I`m facing the same issue

I realized that it is only when we are using fake gps or gpx simulation. On real tests it works fine

MRadek55 avatar Mar 22 '23 07:03 MRadek55