HeadingData

Simple object holding compass heading data.

  • 0.8
  • 0.8
  • 0.8

NOTE This is an abstract type. Any object meeting this description can be used where this type is used.

Defined By

Properties

HeadingData
accuracy : Number

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

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.

HeadingData
magneticHeading : Number

Declination in degrees from magnetic North.

Declination in degrees from magnetic North.

HeadingData
timestamp : Number

Timestamp for the heading data, in milliseconds.

Timestamp for the heading data, in milliseconds.

HeadingData
trueHeading : Number

Declination in degrees from true North.

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.

HeadingData
x : Number

Raw geomagnetic data for the X axis.

Raw geomagnetic data for the X axis.

HeadingData
y : Number

Raw geomagnetic data for the Y axis.

Raw geomagnetic data for the Y axis.

HeadingData
z : Number

Raw geomagnetic data for the Z axis.

Raw geomagnetic data for the Z axis.