• Documentation
  • Plugins
  • Blog
  • Contribute
  • Team
  • Get Started
  • Accelerometer
  • Camera
  • Capture
  • Compass
  • Connection
  • Contacts
  • Device
  • Events
  • File
  • Geolocation
  • Globalization
  • InAppBrowser
  • Media
  • Notification
  • Splashscreen
  • Storage
  • Overview
  • Platform Guides
  • The Cordova Command-line Interface
  • Command-Line Usage
  • Privacy Guide
  • Upgrading Guides
  • Project Settings
  • Plugin Development Guide
  • Domain Whitelist Guide
  • Embedding WebView
  • Accelerometer
  • Camera
  • Capture
  • Compass
  • Connection
  • Contacts
  • Device
  • Events
  • File
  • Geolocation
  • Globalization
  • InAppBrowser
  • Media
  • Notification
  • Splashscreen
  • Storage
  • Overview
  • Platform Guides
  • The Cordova Command-line Interface
  • Command-Line Usage
  • Privacy Guide
  • Upgrading Guides
  • Project Settings
  • Plugin Development Guide
  • Domain Whitelist Guide
  • Embedding WebView
  • 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.

Compass

Obtains the direction that the device is pointing.

Methods

  • compass.getCurrentHeading
  • compass.watchHeading
  • compass.clearWatch
  • compass.watchHeadingFilter (obsolete)
  • compass.clearWatchFilter (obsolete)

Arguments

  • compassSuccess
  • compassError
  • compassOptions
  • compassHeading

Permissions

Android

app/res/xml/config.xml

<plugin name="Compass" value="org.apache.cordova.CompassListener" />

BlackBerry WebWorks

No permissions are required.

iOS

config.xml

<plugin name="Compass" value="CDVLocation" />

Windows Phone

Properties/WPAppManifest.xml

<Capabilities>
    <Capability Name="ID_CAP_SENSORS" />
</Capabilities>

Reference: Application Manifest for Windows Phone

Tizen

No permissions are required.

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.