Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29465

Geolocation.getCurrentPosition return wrong coordinates (0;0)

$
0
0

I try to get user location (with permission step no problem), but Google approach with his package react-native-geolocation-service and method getCurrentPosition return this:

{"coords": {"accuracy": 3, "altitude": 0, "heading": 0, "latitude": 0, "longitude": 0, "speed": 0}, "mocked": false, "timestamp": 1580744874000}.

I use this code (example from official documentation).

In brief:

Geolocation.getCurrentPosition(
        (position) => {
          this.setState({ location: position, loading: false });
          console.log(position);
        },
        (error) => {
          this.setState({ location: error, loading: false });
          console.log(error);
        },
        { enableHighAccuracy: true, timeout: 15000, maximumAge: 10000 }

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> added to AndroidManifest.xml


Viewing all articles
Browse latest Browse all 29465

Trending Articles