Is there a way i can check if location services is completely turned off on the device before trying to get a position?
I have the following
Geolocation.getCurrentPosition().then((position) => {
console.log(`got position at ${position.coords.latitude}, ${position.coords.longitude}`);
}, error => {
console.log('Location error with user id existing', error);
});
nothing is being written to the log, i even tried the .catch() still nothing is being written, the error does fire if i deny gps location to the browser when testing, my problem is on the device, if location services is turned on everything works but i want to do something when location is off/cant get location so i notify the user about it but cant seem to catch the right place for the error.
UPDATE/SOLVED
From the plug-in website… https://github.com/apache/cordova-plugin-geolocation
Android Quirks
If Geolocation service is turned off the onError callback is invoked after timeout interval (if specified). If timeout parameter is not specified then no callback is called.