Titanium.Geolocation

Submodule of Titanium.
Platform Since
Android 0.1
iPhone 0.1
iPad 0.1
Mobile Web 0.1

Summary

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

Methods

Name Summary
addEventListener

Adds the specified callback as an event listener for the named event.

fireEvent

Fires a synthesized event to any registered listeners.

forwardGeocoder

tries to resolve an address to a location. (Android, iPhone, iPad only.)

getCurrentHeading

retrieve the current compass heading. (Android, iPhone, iPad only.)

getCurrentPosition

retrieve the last known location from the device. On Android, the radios are not turned on to update the location. On iOS the radios MAY be used if the location is too "old".

removeEventListener

Removes the specified callback as an event listener for the named event.

reverseGeocoder

tries to resolve a location to an address. (Android, iPhone, iPad only.)

setShowCalibration

configure the calibration UI. set the false to disable the calibration display. (iPhone, iPad, Mobile Web only.)

Properties

Name Type Summary
ACCURACY_BEST Number

accuracy constant read-only

ACCURACY_HUNDRED_METERS Number

accuracy constant read-only

ACCURACY_KILOMETER Number

accuracy constant read-only

ACCURACY_NEAREST_TEN_METERS Number

accuracy constant read-only

ACCURACY_THREE_KILOMETERS Number

accuracy constant read-only

AUTHORIZATION_AUTHORIZED Number

authorization constant (iPhone, iPad, Mobile Web only.) read-only

AUTHORIZATION_DENIED Number

authorization constant (user disabled authorization) (iPhone, iPad, Mobile Web only.) read-only

AUTHORIZATION_RESTRICTED Number

authorization constant (system disabled authorization) (iPhone, iPad, Mobile Web only.) read-only

AUTHORIZATION_UNKNOWN Number

authorization constant (iPhone, iPad, Mobile Web only.) read-only

ERROR_DENIED Number

error constant (iPhone, iPad, Mobile Web only.) read-only

ERROR_HEADING_FAILURE Number

error constant (iPhone, iPad, Mobile Web only.) read-only

ERROR_LOCATION_UNKNOWN Number

error constant (iPhone, iPad, Mobile Web only.) read-only

ERROR_NETWORK Number

error constant (iPhone, iPad, Mobile Web only.) read-only

ERROR_REGION_MONITORING_DELAYED Number

error constant (iPhone, iPad, Mobile Web only.) read-only

ERROR_REGION_MONITORING_DENIED Number

error constant (iPhone, iPad, Mobile Web only.) read-only

ERROR_REGION_MONITORING_FAILURE Number

error constant (iPhone, iPad, Mobile Web only.) read-only

PROVIDER_GPS String

The GPS location provider (Android, Mobile Web only.) read-only

PROVIDER_NETWORK String

The Network location provider (Android, Mobile Web only.) read-only

distanceFilter Number

The minimum change of position (in meters) before a 'location' event is fired. Default is 0, meaning that location events are continuously generated. (iPhone, iPad only.)

headingFilter Number

The minium change of heading (in degrees) before a 'heading' event is fired. Default is 0, meaning that heading events are continuously generated. (iPhone, iPad only.)

locationServicesAuthorization Number

Returns an authorization constant indicating if the application has access to location services. Always returns AUTHORIZATION_UNKNOWN on pre-4.2 devices. Attempting to re-authorize when AUTHORIZATION_RESTRICTED will lead to issues (iPhone, iPad only.)

locationServicesEnabled Boolean

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

preferredProvider String

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

purpose String

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. (iPhone, iPad only.)

showCalibration Boolean

returns true if the calibration UI can show (iPhone, iPad only.)

Events

Name Summary
calibration

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

heading

fired when a heading event is received (Android, iPhone, iPad only.)

location

fired when a location event is received