I need some help with one issue on react. The question is how can I enable my geolocation if status denied.
Screenshot
Example how to call or redirect to location settings
create a function to check the permission status and request permission if the status is denied
function getLocation() {
if (navigator.geolocation) {
navigator.permissions.query({name:'geolocation'}).then(permissionStatus => {
if (permissionStatus.state === 'denied') {
alert('Please allow location access.');
window.location.href = "app-settings:location";
} else {
navigator.geolocation.getCurrentPosition(success, error);
}
});
} else {
alert('Geolocation is not supported in your browser.');
}
}