Cordova Version:

Document TOP » API Reference » Core Cordova Plugins » Device Motion Plugin

Device Motion Plugin

Tested Version: 1.2.5


This document is based on the original Cordova docs available at Cordova Docs.

This plugin provides access to the device’s accelerometer. 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 axis.

Access is via a global navigator.accelerometer object.

Although the object is attached to the global scoped navigator, it is not available until after the deviceready event.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {

Plugin ID


Adding the Plugin in Monaca

In order to use this plugin, please enable Device Motion plugin in Monaca Cloud IDE.

Supported Platforms

  • Android
  • iOS
  • Windows


  • navigator.accelerometer.getCurrentAcceleration
  • navigator.accelerometer.watchAcceleration
  • navigator.accelerometer.clearWatch



Contains Accelerometer data captured at a specific point in time. Acceleration values include the effect of gravity (9.81 m/s^2), so that when a device lies flat and facing up, x, y, and z values returned should be 0, 0, and 9.81.


  • x: Amount of acceleration on the x-axis. (in m/s^2) (Number)
  • y: Amount of acceleration on the y-axis. (in m/s^2) (Number)
  • z: Amount of acceleration on the z-axis. (in m/s^2) (Number)
  • timestamp: Creation timestamp in milliseconds. (DOMTimeStamp)