FreeSoft
English EN

History & articles

Migrating from the Cordova Device Motion Plugin

How the historical accelerometer-plugin migration relates to browser motion events and their specification.

Editorial archive guide10 August 2017 · Vishal Mishra
Archive note. Historical reference. PhoneGap tools and the former Adobe services are no longer maintained as described in the original material. Recovered text and newly written explanations are identified below; consult current platform documentation for active development.

The historical migration

The 2017 article by Vishal Mishra described moving from navigator.accelerometer watchers to browser devicemotion events. It contrasted a plugin watcher with event-listener registration and removal, and introduced the event’s acceleration, acceleration-including-gravity and rotation-rate fields.

Read the original article and its examples. This page summarizes the article rather than reproducing it.

Interpreting motion data

The W3C specification defines acceleration and rotation in a device coordinate frame. Acceleration with gravity and linear acceleration are different quantities. It also specifies secure-context and permission requirements; applications must account for unavailable readings and the behavior of their target browser.

The historical plugin’s sampling options and callback lifecycle should not be assumed to map directly onto browser events. Consult the relevant implementation documentation when updating an application.

Sources & archive notes

Recovered repository material is attributed to its original authors and distributed with its source license. Changes: FreeSoft layout, archive context, navigation, link and image locations. Apache License 2.0 · Notices and provenance. Editorial material is labeled separately.