enableHighAccuracy:
bool: get better accuracy if true - default=false
timeout:
long: maximum length of time (in milliseconds) the devices is allowed to take in order to return a position - default=Infinity
maximumAge:
long: maximum age in milliseconds of a possible cached position that is acceptable to return. If 0, device cannot use cached value and must retrieve real current position. if Infinity must use cached position. - default=0
Back
clearWatch()
Front
clears a watch handler
params:
- watchID
Back
Get current position
Front
navigator.geolocation.getCurrentPosition(success, error, options);
success and error are functions, options is an object
Back
Check for geolocation api
Front
if ("geolocation" in navigator) {
// available
} else {
// not available
}
Back
Position Object
Front
coords: coordinates object
timestamp: readonly
Back
coordinates object
Front
- latitude: decimal degrees
- longitude: decimal degrees
- altitude: meters from sea level (can be null)
- accuracy: meters
- heading: degrees from north with 0 being north. NaN if speed is 0 and null if no information avalible
- speed: meters per second
Back
watchPosition()
Front
registers a handler function that will be called automatically each time the position of the device changes.
params:
- success: function
- error: function
- options: PositionOptions