I'm working with Ionic Geolocation and debug on mobile app "Ionic DevApp".
The problem is when I accept permissions for use my GPS, later response as error PositionError.PERMISSION_DENIED. I was try resolve searching in web (Mozilla and W3) but don't correct my error.
My code:
// onSuccess Callback
// This method accepts a Position object, which contains the
// current GPS coordinates
var onSuccess = function (position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Speed: ' + position.coords.speed + '\n' +
'Timestamp: ' + position.timestamp + '\n');
};
// onError Callback receives a PositionError object
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
navigator.geolocation.getCurrentPosition(onSuccess, onError, { enableHighAccuracy: true });
¿Why don't accept my permissions?