'Cordova.Diganostic.IsLocationEnabled always returns true ionic
As title says, whether location is turned off or on success callback is always triggered. Anyone got any suggestions?
if (window.cordova) {
window.cordova.plugins.diagnostic.isLocationEnabled(locationEnabled,locationDisabled );
}
function locationEnabled() {.. }
function locationDisabled() {...}
I'm testing it on Samsung galaxy s5 with lolipop
Solution 1:[1]
Old topic, but good to know that isLocationEnabled() is now working as a Promise, so you'll have to do the following.
window.cordova.plugins.diagnostic
.isLocationEnabled()
.then((locationEnabled) => {
if (locationEnabled) {
locationEnabled()
} else {
locationDisabled()
}
})
.catch((error) => {
console.log('The following error occurred: ' + error)
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Raphaël Balet |
