The Cordova Compass API provides Cordova applications with the ability to measure the orientation of the mobile device running the application. The API is typically used in games and augmented reality applications. The device orientation can be measured in real-time, measurements taken as needed by the application or the application can enable a compass watch that allows the application to automatically be notified when the device’s heading has changed.

The chapter includes two example applications that demonstrate how to implement both types of measurements. The first one illustrates how to implement a compass measurement as shown in the figure below.

The second example application illustrates how to implement a Compass watch.