FreeSoft
English EN

History & articles

Migrating from the Cordova Device Orientation Plugin

The historical migration from navigator.compass to browser orientation events, with a link to the original article and current specification.

Editorial archive guide9 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

Vishal Mishra’s 2017 article discussed replacing the Cordova compass plugin with browser orientation events. It compared the plugin’s heading watcher and cleanup method with registering and removing a deviceorientation listener. The browser event exposes orientation angles through alpha, beta and gamma.

Read the original article and its examples. This is an editorial summary of that historical guidance.

Read the specification before adapting old examples

The newer W3C Device Orientation and Motion specification distinguishes relative from absolute orientation. An angle is not automatically a magnetic compass heading in every device position or reference frame. The specification also addresses secure contexts and permissions. Those differences matter when adapting an old example; the 2017 article should not be treated as a guarantee of present browser behavior.

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.