Unlike the geolocation API, a single reading of the device's accelerometer is not all that interesting. In this example, we're going to poll the accelerometer for a period, to see how the readings change as we shake the device.
You will not get very far with the accelerometer on a desktop web browser or an emulator. This is the first API we've encountered that really requires a device at hand to measure your progress. You can refer back to Chapter 1 for details on how to get a PhoneGap application loaded onto your device.
devicereadyevent and, once it fires, call