- Accelerometer
- Camera
- Capture
- Compass
- Connection
- Contacts
- Device
- Events
- File
- Geolocation
- Globalization
- InAppBrowser
- Media
- Notification
- Splashscreen
- Storage
- Getting Started Guides
- Command-Line Usage
- Privacy Guide
- Upgrading Guides
- Project Settings
- Plugin Development Guide
- Domain Whitelist Guide
- Embedding WebView
This version of the documentation is outdated!
Click here for the latest released version.
geolocationSuccess
The user's callback function that is called when a geolocation position becomes available (when using with [geolocation.getCurrentPosition](../geolocation.getCurrentPosition.html)
), or when the position changes (when using with [geolocation.watchPosition](../geolocation.watchPosition.html)
).
function(position) {
// Do something
}
Parameters
- position: The geolocation position returned by the device. (
[Position](../Position/position.html)
)
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');
}