Cordova plugin to access the device gyroscope.
npm install cordova-plugin-device-gyroscope> This project is a fork of the old cordova-plugin-gyroscope published by Jason Yang. Thanks to him, this plugin is working.
This project's idea is inspired from these two projects.
- Android Gyroscope
- iOS Gyroscope
This project is merged by those two projects.
``bash`
cordova plugin add cordova-plugin-device-gyroscope@0.2.2
This plugin is working like the Apache Cordova Accelerometer plugin, the API is the same.
`javascript`
navigator.gyroscope.getCurrentGyroscope(gyroscopeSuccess, gyroscopeError);
`javascript`
var watchID = navigator.gyroscope.watchGyroscope(gyroscopeSuccess,
gyroscopeError,
gyroscopeOptions);
`javascript``
navigator.gyroscope.clearWatch(watchID);