michalchudziak/react-native-geolocation

Speed value returns -1 and 0

MRadek55 opened this issue · 2 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 have you found a solution for this?
I`m facing the same issue

@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