# HeadingData

> Simple object holding compass heading data.

- Source: https://titaniumsdk.com/docs/sdk/13.1.0/HeadingData
- Titanium SDK version: 13.1.0
- Kind: pseudo
- Platforms: Android, iPhone, iPad, macOS

## Properties

### accuracy

- Type: Number
- Platforms: Android, iPhone, iPad, macOS

Accuracy of the compass heading, in platform-specific units.

On iOS, accuracy is returned as a maximum deviation in degrees,
the smaller the value, the more accurate the heading is. For example,
a value of 10 means the heading is plus or minus 10 degrees from the
actual value. A negative value indicates the compass heading is invalid;
for example, if there is magnetic interference, or if the compass is not calibrated.

On Android, the value is set to either 1 (low accuracy), 2 (medium accuracy)
or 3 (high accuracy). No specific definition of these accuracy values is supplied.

### magneticHeading

- Type: Number
- Platforms: Android, iPhone, iPad, macOS

Declination in degrees from magnetic North.

### timestamp

- Type: Number
- Platforms: Android, iPhone, iPad, macOS

Timestamp for the heading data, in milliseconds.

### trueHeading

- Type: Number
- Platforms: Android, iPhone, iPad, macOS

Declination in degrees from true North.

Calculating the true heading requires correcting the magnetic declination based on
the device's current location. So `trueHeading` can only be calculated if the device
has a fairly recent location fix. If you want to obtain the true heading, you
should register for location updates as well as compass updates. The location fix
does not need to be very accurate.

On Android, `trueHeading` is `undefined` if a recent location fix is not available.

### x

- Type: Number
- Platforms: Android, iPhone, iPad, macOS

Raw geomagnetic data for the X axis.

### y

- Type: Number
- Platforms: Android, iPhone, iPad, macOS

Raw geomagnetic data for the Y axis.

### z

- Type: Number
- Platforms: Android, iPhone, iPad, macOS

Raw geomagnetic data for the Z axis.

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

