getCurrentAcceleration method obtains data from the accelerometer at the time it was called - a single call to obtain a single response object. In this recipe, we'll build an application that allows us to set an interval to obtain a constant update from the accelerometer to detect continual movement from the device.
We will provide additional parameters to a new method available through the PhoneGap API to set the update interval:
accelupdate. Open Terminal or Command Prompt and run the following command:
phonegap create accelupdate com.myapp.accelupdate accelupate