geolocationSuccess

The user's callback function that executes when a geolocation position becomes available (when called from [geolocation.getCurrentPosition](../geolocation.getCurrentPosition.html)), or when the position changes (when called from [geolocation.watchPosition](../geolocation.watchPosition.html)).

function(position) {
    // Do something
}

Parameters

  • position: The geolocation position returned by the device. (Position)

Example

function geolocationSuccess(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');
}