Module: Toybox.Position
Overview
Classes Under Namespace
Constant Summary
-
Constellation
-
Configuration
-
CoordinateFormat
-
Quality
-
LocationAcquisitionType
-
PositioningMode
This enum may be removed after System 10.
| Name | Value | Since | Description |
|---|---|---|---|
| CONSTELLATION_GPS | 0 | API Level 3.2.0 |
Use the GPS satellite constellation |
| CONSTELLATION_GLONASS | 1 | API Level 3.2.0 |
Use the GLONASS satellite constellation |
| CONSTELLATION_GALILEO | 2 | API Level 3.2.0 |
Use the GALILEO satellite constellation |
Configuration values for known GNSS configurations
| Name | Value | Since | Description |
|---|---|---|---|
| CONFIGURATION_GPS | 1 | API Level 3.3.6 |
GPS L1
Not supported in devices that have Dynamic SatIQ™, use |
| CONFIGURATION_GPS_GLONASS | 2 | API Level 3.3.6 |
GPS L1 and GLONASS
Not supported in devices that have Dynamic SatIQ™, use |
| CONFIGURATION_GPS_GALILEO | 3 | API Level 3.3.6 |
GPS L1 and GALILEO L1
Not supported in devices that have Dynamic SatIQ™, use |
| CONFIGURATION_GPS_BEIDOU | 4 | API Level 3.3.6 |
GPS L1 and BEIDOU L1
Not supported in devices that have Dynamic SatIQ™, use |
| CONFIGURATION_GPS_GLONASS_GALILEO_BEIDOU_L1 | 5 | API Level 3.3.6 |
GPS L1, GLONASS, GALILEO L1, BEIDOU L1 This option is supported by System 6 devices like fenix7 and edge1040
Not supported in devices that have Dynamic SatIQ™, use |
| CONFIGURATION_GPS_GLONASS_GALILEO_BEIDOU_L1_L5 | 6 | API Level 3.3.6 |
GPS L1, GPS L5, GLONASS, GALILEO L1A, GALILEO L5, BEIDOU L1, BEIDOU L5 Referred to as Multi-GNSS Multi-band on Edge 1040. This option is supported by System 6 devices like fenix7 and edge1040
Not supported in devices that have Dynamic SatIQ™, use |
| CONFIGURATION_SAT_IQ | 255 | API Level 3.3.6 |
AutoGNSS (SatIQ™) This is equivalent to CONFIGURATION_SAT_IQ_NORMAL mode in devices with Dynamic SatIQ™ support. |
| CONFIGURATION_SAT_IQ_NORMAL | 255 | API Level 6.0.1 |
Dynamic SatIQ™ Normal Mode. Balance between accuracy and battery life. |
| CONFIGURATION_SAT_IQ_EXTENDED_BATTERY | 256 | API Level 6.0.1 |
Dynamic SatIQ™ Extended Battery Mode. Longer battery life with good accuracy. |
| CONFIGURATION_SAT_IQ_MAX_BATTERY | 257 | API Level 6.0.1 |
Dynamic SatIQ™ Max Battery Mode. Longest battery life, but lower accuracy. |
| CONFIGURATION_SAT_IQ_MAX_ACCURACY | 258 | API Level 6.0.1 |
Dynamic SatIQ™ Max Accuracy Mode. Best accuracy, but higher battery consumption. |
| Name | Value | Since | Description | See Also |
|---|---|---|---|---|
| GEO_DEG | 0 | API Level 1.0.0 |
The decimal degree format: ddd.dddddd (e.g. 38.278652) |
|
| GEO_DM | 1 | API Level 1.0.0 |
The degrees/decimal minutes format: dddmm.mmm (e.g 38 27.865') |
|
| GEO_DMS | 2 | API Level 1.0.0 |
degrees/minutes/seconds (DMS) format: ddd mm ss (e.g. 38 27' 8") |
|
| GEO_MGRS | 3 | API Level 1.0.0 |
Military Grid Reference System, or MGRS (e.g. 4QFJ12345678) |
| Name | Value | Since | Description | See Also |
|---|---|---|---|---|
| QUALITY_NOT_AVAILABLE | 0 | API Level 1.0.0 |
GPS is not available |
|
| QUALITY_LAST_KNOWN | 1 | API Level 1.0.0 |
The Location is based on the last known GPS fix. |
|
| QUALITY_POOR | 2 | API Level 1.0.0 |
The Location was calculated with a poor GPS fix. Only a 2-D GPS fix is available, likely due to a limited number of tracked satellites. |
|
| QUALITY_USABLE | 3 | API Level 1.0.0 |
The Location was calculated with a usable GPS fix. A 3-D GPS fix is available, with marginal HDOP (horizontal dilution of precision) |
|
| QUALITY_GOOD | 4 | API Level 1.0.0 |
The Location was calculated with a good GPS fix. A 3-D GPS fix is available, with good-to-excellent HDOP (horizontal dilution of precision). |
| Name | Value | Since | Description |
|---|---|---|---|
| LOCATION_ONE_SHOT | 0 | API Level 1.0.0 |
Enables a one-time Location acquisition |
| LOCATION_CONTINUOUS | 1 | API Level 1.0.0 |
Enables continuous Location tracking |
| LOCATION_DISABLE | 2 | API Level 1.0.0 |
Disables Location tracking |
| Name | Value | Since | Description |
|---|---|---|---|
| POSITIONING_MODE_NORMAL | 0 | API Level 3.2.0 |
Standard positioning mode used by default for fitness activities |
| POSITIONING_MODE_AVIATION | 1 | API Level 3.2.0 |
Enable special mode for aviation use-cases that require support for higher altitudes. |
Instance Method Summary collapse
-
createBoundingBox(locations as Lang.Array<Position.Location>) as [ Position.Location, Position.Location ] or Null
Create a bounding box from an array of Location objects.
-
enableLocationEvents(options as { :acquisitionType as Position.LocationAcquisitionType, :constellations as Lang.Array<Position.Constellation>, :configuration as Position.Configuration, :mode as Position.PositioningMode } or Position.LocationAcquisitionType, listener as Null or Lang.Method(loc as Position.Info) as Void) as Void
Request a Location event.
-
getInfo() as Position.Info
Get the current Position.Info.
-
hasConfigurationSupport(config as Position.Configuration) as Lang.Boolean
Determines if the device supports a requested GPS configuration.
-
parse(string as Lang.String, format as Position.CoordinateFormat) as Position.Location
Convert a String to a Location object.
Instance Method Details
createBoundingBox(locations as Lang.Array<Position.Location>) as [ Position.Location, Position.Location ] or Null
Create a bounding box from an array of Location objects.
enableLocationEvents(options as { :acquisitionType as Position.LocationAcquisitionType, :constellations as Lang.Array<Position.Constellation>, :configuration as Position.Configuration, :mode as Position.PositioningMode } or Position.LocationAcquisitionType, listener as Null or Lang.Method(loc as Position.Info) as Void) as Void
Request a Location event.
Using this API requires enabling the Positioning Permission. Only Device Apps and Widgets may use this API.
Passing an options Dictionary is only supported with ConnectIQ 3.2.0 and later.
Passing the :configuration option is only supported with ConnectIQ 3.3.6 or later.
Multitasking: Location events will be disabled when app enters inacitve state, and re-enabled when is active again. These state changes are denoted by calls to AppBase.onActive() and AppBase.onInactive().
getInfo() as Position.Info
Get the current Position.Info.
Using this API requires enabling the Positioning Permission. This is useful for retrieving the current position info either on demand or periodically within a Timer.
hasConfigurationSupport(config as Position.Configuration) as Lang.Boolean
Determines if the device supports a requested GPS configuration
parse(string as Lang.String, format as Position.CoordinateFormat) as Position.Location
Convert a String to a Location object.
The input String must be in one of the four formats described by the Position.GEO_* constants.