Class adobeDPS-GeolocationService
- Extends:
- adobeDPS-GeolocationService -> adobeDPS-Service -> adobeDPS-Class
- Platforms:
- iOS
Service for accessing geolocation data.
This is compatible with the WebKit Geolocation interface
Accessible from adobeDPS.geolocation
Constructor
[inner]
Create an instance of the GeolocationService.
Static Fields
Field | Defined By | |
---|---|---|
adobeDPS-GeolocationService.instance
The singleton of the GeolocationService.
|
GeolocationService
|
Methods
Method | Defined By | |
---|---|---|
getCurrentPosition(successCallback:Function, errorCallback:Function, options:adobeDPS-PositionOptions)
Function used to retrieve the current device location.
|
GeolocationService
|
|
watchPosition(successCallback:Function, errorCallback:Function, options:adobeDPS-PositionOptions)
Function used to monitor the location changes.
|
GeolocationService
|
|
clearWatch(watchId:Number)
Function used to stop monitoring the location changes initiated through watchPosition().
|
GeolocationService
|
|
toString()
Gets the string representation of this instance.
|
Class Detail
adobeDPS-GeolocationService()
[inner]
Create an instance of the GeolocationService.
This is an internal constructor and shouldn't be called by regular users.
This is an internal constructor and shouldn't be called by regular users.
Static Field Details
adobeDPS-GeolocationService.instance
The singleton of the GeolocationService.
- Platforms:
- iOS
Method Details
getCurrentPosition(successCallback:Function, errorCallback:Function, options:adobeDPS-PositionOptions)
Function used to retrieve the current device location. This is compatible with the WebKit geolocation API.
// Call the API to get the current position. adobeDPS.geolocation.getCurrentPosition( // The success callback for getCurrentPosition(). function(position) { var coords = position.coords; var lat = coords.latitude; var lon = coords.longitude; // Measured in meters. The reported position is within this amount of your location. var accuracy = coords.accuracy; // Altitude measured in meters. var altitude = coords.altitude; // Measured in meters. The reported altitude is within this amount of your location. var altitudeAccuracy = coords.altitudeAccuracy; // Measure in degrees. -1 if the user is static or the value cannot be determined. var heading = coords.heading; // Measured in meters per second. -1 if the user is static or the value cannot be determined. var speed = coords.speed; // Output the values for getCurrentPosition(). $("#output").append("latitude: " + lat + "<br>"); $("#output").append("longitude: " + lon + "<br>"); $("#output").append("accuracy: " + accuracy + "<br>"); $("#output").append("altitude: " + altitude + "<br>"); $("#output").append("altitudeAccuracy: " + altitudeAccuracy + "<br>"); $("#output").append("heading: " + heading + "<br>"); $("#output").append("speed: " + speed + "<br>"); }, // The error callback for getCurrentPosition(). function(data) { $("#output").append("code: " + data.code + "<br>"); $("#output").append("message: " + data.message); } }
Parameters | ||
---|---|---|
successCallback | Function |
The callback function that handles the location data when operation succeeds. Callback Signature: successHandler(adobeDPS-Position) |
errorCallback | Function |
The callback function that handles the error when operation fails. Callback Signature: errorHandler(adobeDPS-PositionError) |
options | adobeDPS-PositionOptions | The options considered when retrieving the position. |
- Throws:
- Error If the successCallback is invalid
- Platforms:
- iOS
watchPosition(successCallback:Function, errorCallback:Function, options:adobeDPS-PositionOptions)
: Number
Function used to monitor the location changes. This is compatible with the WebKit geolocation API.
Currently this API is not supported. Any attempt to call it will throw an exception.
Currently this API is not supported. Any attempt to call it will throw an exception.
Parameters | ||
---|---|---|
successCallback | Function |
The callback function that handles the location data when operation succeeds. Callback Signature: successHandler(adobeDPS-Position) |
errorCallback | Function |
The callback function that handles the error when operation fails. Callback Signature: errorHandler(adobeDPS-PositionError) |
options | adobeDPS-PositionOptions | The options considered when retrieving the position. |
- Throws:
- Error If the successCallback is invalid
- Returns:
- Number A unique ID of the location monitoring operation
- Platforms:
- iOS
clearWatch(watchId:Number)
Function used to stop monitoring the location changes initiated through watchPosition(). This is compatible with the WebKit geolocation API.
Currently this API is not supported. Any attempt to call it will throw an exception.
Currently this API is not supported. Any attempt to call it will throw an exception.
Parameters | ||
---|---|---|
watchId | Number | The Id of a watchPosition operation to be cancelled. |
- Platforms:
- iOS
©2012-2013 Adobe Systems, inc
Documentation generated by JsDoc Toolkit 2.4.0 on Mon Aug 31 2015 09:23:26 GMT-0700 (PDT)
Documentation generated by JsDoc Toolkit 2.4.0 on Mon Aug 31 2015 09:23:26 GMT-0700 (PDT)