Titanium.Geolocation

submodule of Titanium
           
0.1

The top level Geolocation module. The Geolocation module is used for accessing device location based information.

Methods

Name Description
addEventListener add an event listener for the instance to receive view triggered events
fireEvent fire a synthesized event to the views listener
removeEventListener remove a previously added event listener
setShowCalibration

configure the calibration UI. set the false to disable the calibration display.

Properties

Name Type Description
ACCURACY_BEST int

accuracy constant

ACCURACY_HUNDRED_METERS int

accuracy constant

ACCURACY_KILOMETER int

accuracy constant

ACCURACY_NEAREST_TEN_METERS int

accuracy constant

ACCURACY_THREE_KILOMETERS int

accuracy constant

PROVIDER_GPS string

The GPS location provider

PROVIDER_NETWORK string

The Network location provider

locationServicesEnabled boolean

returns true if the user has enabled or disable location services for the device (not the application).

preferredProvider string

allows setting of the preferred location provider. Returns undefined when the preferred provider is auto-detected

purpose string

(iOS only). This property informs the end-user why location services are being requested by the application. This string will be display in the permission dialog. This property is REQUIRED starting in 4.0.

showCalibration boolean

returns true if the calibration UI can show

Events

Name Description
calibration

fired only on iPhone/iPad when the device detects interface and requires calibration. when this event is fired, the calibration UI is being displayed to the end user.

Event properties

sourcethe source object that fired the event
typethe name of the event fired
heading

fired when a heading event is received

Event properties

error

if success is false, returns a string of the error description

heading

heading results dictionary with the following sub-properties: magneticHeading, trueHeading, accuracy, x, y, z, timestamp.

sourcethe source object that fired the event
success

boolean to indicate if the heading event was successfully received or an error occurred

typethe name of the event fired
location

fired when a location event is received

Event properties

coords

location coordinates dictionary with the following sub-properties: latitude, longitude, altitude, accuracy, altitudeAccuracy, heading, speed, timestamp.

error

if success is false, returns a string of the error description

sourcethe source object that fired the event
success

boolean to indicate if the location event was successfully received or an error occurred

typethe name of the event fired