I am developing iPad application using phonegap (cordova 1.9.0). I need to get current position of the user. I used following code and it works fine when Location services are enabled.
function onDeviceReady() {
navigator.geolocation.getCurrentPosition(onSuccess, onError);
}
function onSuccess(position) {
console.log(position.coords.latitude + "-" + position.coords.longitude);
}
function onError(error) {
alert('code: ' + error.code
'message: ' + error.message + '\n');
}
My problem is that this code not working when Location services are disabled. I need to get current location if Location service are enabled or disabled.
Anyone tell me how to get current location in this situtation?