API Documentation

for 0.0.1
Show:

GPS Class

Constructor

GPS

(
  • params
)

Parameters:

  • params Object

    Config parameters

    • context Object

      the Mobilizing context this Input instance is linked to

    • enableHighAccuracy Boolean

      Boolean to activate accurate location (eats more battery and takes time)

    • maximumAge Number

      Number of millisecond to define the maximum age of the geolocation data (default = 500000)

    • timeout Number

      timeout of the location service in millisecond

Methods

getLocation

() Object

returns the most recent location data. Location service MUST be activated on the device, or errors will get out from the callbacks! The return objects contains the standard HTML5 properties for geolocation :

location.longitude
location.latitude
location.altitude
location.accuracy
location.altitudeAccuracy
location.heading
location.speed
location.timestamp

Returns:

Object:

the location object updated with the most recent data.

off

()

Deactivate the component

on

()

Activates the component

resetLocation

() deprecated private

reset the location object to avoid bugs

setHighAccuracy

(
  • val
)

Enable HighAccuracy. Requieres to set the component off once then to set it on again to use the new value.

Parameters:

  • val Boolean

    Enable or not high accuracy

setMaximumAge

(
  • val
)

Set the maximum age of a location data. Requieres to set the component off once then to set it on again to use the new value.

Parameters:

  • val Number

    the new value

setTimeout

(
  • val
)

Set the time out for location update. Requieres to set the component off once then to set it again on to use the new value.

Parameters:

  • val Number

    the new value

setup

()

Set the GPS up.

updateLocationCallBack

(
  • position
)
private

Listener for the update of the location object with the most recent data.

Parameters:

  • position Object

    the HTML5 position object to use for the Mobilizing location object's update

updateLocationErrorCallBack

(
  • error
)
private

Listener for the update errors of the location object with the most recent data.

Parameters:

  • error Object

Properties

_enableHighAccuracy

Boolean private

Accurate location (eats more battery and takes time)

_GPSAvailable

Boolean private

true if the GPS is available on the device, false otherwise

_location

Object private

Object containing the informations given by the GPS. Used internally.

_maximumAge

Number private

Number of millisecond to define the maximum age of the geolocation data

_timeout

Number private

Timeout of the location service in millisecond

Events

locationerror

Fired when the location update generated an error

locationupdated

Fired when the location has been updated