Reputation: 1350
On my iOS app the geolocation works fine and picks up my location on the watcher function.
However for Android, the code never seems to get executed on the success or fail callbacks when I put in alert's 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}
);
Upvotes: 4
Views: 1670
Reputation: 2448
If you are running with newest Android, you manual set "Location" to on. This switch is under Setting -> Apps -> {Your app} -> Permissions.
Upvotes: 3