• Documentation
  • Plugins
  • Blog
  • Contribute
  • Team
  • Get Started
  • Accelerometer
  • Camera
  • Capture
  • Compass
  • Connection
  • Contacts
  • Device
  • Events
  • File
  • Geolocation
  • Media
  • Notification
  • Storage
  • Getting Started Guides
  • Accelerometer
  • Camera
  • Capture
  • Compass
  • Connection
  • Contacts
  • Device
  • Events
  • File
  • Geolocation
  • Media
  • Notification
  • Storage
  • Getting Started Guides
  • dev
  • 12.x-2025.01 (Latest)
  • 12.x
  • 11.x
  • 10.x
  • 9.x
  • 8.x
  • 7.x
  • 6.x
  • 5.4.0
  • 5.1.1
  • 5.0.0
  • 4.0.0
  • 3.6.0
  • 3.5.0
  • 3.4.0
  • 3.3.0
  • 3.2.0
  • 3.1.0
  • 3.0.0
  • 2.9.0
  • 2.8.0
  • 2.7.0
  • 2.6.0
  • 2.5.0
  • 2.4.0
  • 2.3.0
  • 2.2.0
  • 2.1.0
  • 2.0.0
  • 1.9.0
  • 1.8.1
  • 1.8.0
  • 1.7.0
  • 1.6.1
  • 1.6.0
  • 1.5.0
This version of the documentation is outdated! Click here for the latest released version.

compassSuccess

onSuccess callback function that provides the compass heading information via a compassHeading object.

function(heading) {
    // Do something
}

Parameters

  • heading: The heading information. (compassHeading)

Example

function onSuccess(heading) {
    alert('Heading: ' + heading.magneticHeading);
};

More Resources

General

  • Apache Project Page
  • Source Distribution
  • License
  • Artwork

Development

  • Source Code
  • Issue Tracker
  • Stack Overflow
  • Mailing List
  • Nightly builds

Apache Software Foundation

  • About ASF
  • Events
  • Become a Sponsor
  • Thanks
  • Security
  • Privacy policy

Contribute

Help Cordova move forward!

Report bugs, improve the docs, or contribute to the code.

Learn More

Follow @apachecordova

Copyright © 2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.
Apache and the Apache feather logos are trademarks of The Apache Software Foundation.

See the attributions page for other copyright & trademark notices.