Get GeoLocation using phonegap when Location services disabled in iPad

cordova, geolocation, html, w3c-geolocation

Solution

You can't get the current location when location services are disabled. That would be a violation of a user's privacy. The point of disabling location services on a device is to prevent applications from getting the current location.

What I've done is display my own dialog with a lengthy explanation of why I need location services before calling `getCurrentPosition()`. I explain that the app won't work without it. I also say something like:

Your device may also ask you for permission.

This increases the chances of someone saying yes to the iPhone dialog.

Problem

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?

Original source