Device motion is an extension that you can use for getting updates about the orientation of the device in 3D space.
The extension calculates and reports angles by use of various sensor fusion algorithms which combine the available sensors into orientation and rotational information. The quality of this information depends mainly on the hardware contained in the current device. Generally we require 3 sensors for these calculations: an accelerometer, a magnetometer and a gyroscope.
The extension works by registering for notifications of device motion. When you register for updates you specify a series of options about the updates which the extension use to determine the algorithm that is used to calculate the device orientation, and also the information format that is returned.