Class Geolocation
Defined in: phonegap.js.
Constructor Attributes | Constructor Name and Description |
---|---|
This class provides access to device GPS data.
|
Field Attributes | Field Name and Description |
---|---|
The last known GPS position.
|
Method Attributes | Method Name and Description |
---|---|
clearWatch(watchId)
Clears the specified position watch.
|
|
getCurrentPosition(successCallback, errorCallback, options)
Asynchronously aquires the current position.
|
|
setError(message)
Called by the geolocation framework when an error occurs while looking up the current position.
|
|
setLocation(position)
Called by the geolocation framework when the current location is found.
|
|
watchPosition(successCallback, errorCallback, options)
Asynchronously aquires the position repeatedly at a given interval.
|
Field Detail
lastPosition
The last known GPS position.
Method Detail
clearWatch(watchId)
Clears the specified position watch.
- Parameters:
- {String} watchId
- The ID of the watch returned from #watchPosition.
getCurrentPosition(successCallback, errorCallback, options)
Asynchronously aquires the current position.
- Parameters:
- {Function} successCallback
- The function to call when the position data is available
- {Function} errorCallback
- The function to call when there is an error getting the position data.
- {PositionOptions} options
- The options for getting the position data such as timeout.
setError(message)
Called by the geolocation framework when an error occurs while looking up the current position.
- Parameters:
- {String} message
- The text of the error message.
setLocation(position)
Called by the geolocation framework when the current location is found.
- Parameters:
- {PositionOptions} position
- The current position.
watchPosition(successCallback, errorCallback, options)
Asynchronously aquires the position repeatedly at a given interval.
- Parameters:
- {Function} successCallback
- The function to call each time the position data is available
- {Function} errorCallback
- The function to call when there is an error getting the position data.
- {PositionOptions} options
- The options for getting the position data such as timeout and the frequency of the watch.