compassHeading

A CompassHeading object is returned to the [compassSuccess](compassSuccess.html) callback function when an error occurs.

Properties

  • magneticHeading: The heading in degrees from 0 - 359.99 at a single moment in time. (Number)
  • trueHeading: The heading relative to the geographic North Pole in degrees 0 - 359.99 at a single moment in time. A negative value indicates that the true heading could not be determined. (Number)
  • headingAccuracy: The deviation in degrees between the reported heading and the true heading. (Number)
  • timestamp: The time at which this heading was determined. (milliseconds)

Description

The CompassHeading object is returned to the user through the [compassSuccess](compassSuccess.html) callback function.

Android Quirks

  • trueHeading is not supported. It will report the same value as magneticHeading
  • headingAccuracy will always be 0 as there is no difference between the magneticHeading and trueHeading on Android.

iOS Quirks

  • trueHeading is only returned when location services are running via navigator.geolocation.watchLocation()
  • For iOS > 4 devices, if the device is rotated and the app supports that orientation, the heading values will be reported back with respect to the current orientation.

Windows Phone 7 Quirks

  • returns trueHeading only, note that this code is largely untested because of a lack of devices that support compass.