1

I am using the plugin for geolocation of cordova and it all works , except the altitude . is my problem or it is not possible to have this value ? This is the plugin code and my:

var onSuccess = function (posizione) {
    alert ('Latitudine:' + position.coords.latitude + '\ n' +
          'Longitude:' + position.coords.longitude + '\ n' +
          'Altitudine:' + position.coords.altitude + '\ n' +
          'Precisione:' + position.coords.accuracy + '\ n' +
          'Altitude Precisione:' + position.coords.altitudeAccuracy + '\ n' +
          'Intestazione:' + position.coords.heading + '\ n' +
          'Speed:' + position.coords.speed + '\ n' +
          'Timestamp:' + position.timestamp + '\ n');
};

// OnError Callback riceve un oggetto PositionError
//
Funzione onError (errore) {
    alert ('codice:' + error.code + '\ n' +
          'Messaggio:' + Error.message + '\ n');
}

navigator.geolocation.getCurrentPosition (onSuccess, onError, {enableHighAccuracy: true});

I repeat , it does not work just that.

Notworck
  • 29
  • 5

1 Answers1

-1

The code works if the data received from the satellite. Before you put minus I recommend to check the availability of satellites and how the code works with data from satellites. My code:

app.positionWatchID = navigator.geolocation.watchPosition(
            function(result){
                app.alt = Math.round(result.coords.altitude) || app.base_alt;
                app.setAltimeterValue(app.alt);
            },
            function(){},
            {
                timeout: 30000,
                maximumAge: 3000,
                enableHighAccuracy: true
            }
        );

Work fine when satellites is visible and i recieved null if satellites is invisible. getCurrentPosition works also