The Device plugin provides access to information about the device's accelerometer data. The accelerometer is a motion sensor that detects the change (delta) in movement relative to the current device orientation, in three dimensions along the x, y, and z axes.
Device Motion plugin is capturing accelerometer data at a specific snapshot in time. Values for the x, y, and z axes are expressed in
m/s^2 and include the effect of gravity (
9.81 m/s^2). For example, when the device is lying on top of the table and facing up, the x and y values are
0 and the z value is returning
To install the plugin you need to run the following command:
phonegap plugin add cordova-plugin-device-motion
The Device Motion plugin has a few methods ...