React native for Android navigator geolocation not working

In my iOS app, geolocation works fine and displays my location as an observer.

However, for Android, the code never runs when it succeeds or fails with a callback when I put it in warning or console logs.

watchID: (null: ?number),

this.watchID = navigator.geolocation.watchPosition(
    (position) => {
        this.setState({ 
            userLocation: position,
            geo: true
        }, this.fetchBusinesses());
    },
    (error) => console.log(error.message),
    {enableHighAccuracy: true, timeout: 2000, maximumAge: 1000}
    );
+4
source share
1 answer

If you work with the latest Android, you manually set the "Location" to. This switch is located under "Settings → Applications → {Your application} → Permissions. enter image description here

+3
source

Source: https://habr.com/ru/post/1621476/


All Articles