Chapter 2 is all about the Cordova Accelerometer API. The chapter includes a complete description of the Accelerometer API, how it works and how to use it in your Cordova applications. The chapter includes two complete sample applications, one that highlights how to read the accelerometer manually in a Cordova application and another that demonstrates how to use a watch to allow your application to receive periodic accelerometer readings automatically.

The following figure shows Example 2.1 running on an Android device.

Example 2.1

The following figure shows Example 2.2 running on an Android device.

Example 2.2