I'm currently working on a project that uses the geolocation service of my phone. I currently have a prolem with this service, it says that geolocation is not authorized.
I've tried to look on the internet and a few people had the same problem but I didn't manage to fix it...
componentDidMount() {
const { coordinate } = this.state;
this.requestCameraPermission();
this.watchID = navigator.geolocation.watchPosition(
position => {
const { routeCoordinates, distanceTravelled } = this.state;
const { latitude, longitude } = position.coords;
const newCoordinate = {
latitude,
longitude
};
console.log({ newCoordinate });
coordinate.timing(newCoordinate).start();
this.setState({
latitude,
longitude,
routeCoordinates: routeCoordinates.concat([newCoordinate]),
distanceTravelled:
distanceTravelled + this.calcDistance(newCoordinate),
prevLatLng: newCoordinate
});
},
error => console.log(error),
{
enableHighAccuracy: true,
timeout: 20000,
maximumAge: 1000,
distanceFilter: 10
}
);
}
Instead of appearing on my current spot, i'm in San Fransisco (which is the default location on maps). The function navigator.geolocation.watchPosition gets the error : "code": "E_LOCATION_UNAUTHORIZED", "message": "Not authorized to use location services", "watchId": 1,
My phone is a Samsung S9 and the location service is enabled... So I'm really curious about the problem I have right now.