This project's idea is inspired from these two projects.
This project is merged by those two projects, and also provided an Angular module
called deviceGyroscope
.
cordova plugin add [email protected]
var gyroscope = navigator.gyroscope;
gyroscope.getCurrent
gyroscope.watch
gyroscope.clearWatch
- Copy
deviceGyroscope.js
to your project folder. - Add
deviceGyroscope
as a module.
angular
.module(
'app', [
... other modules
'deviceGyroscope'
]
)
- Inject
$deviceGyroscope
in controller. It's return a promise.
$deviceGyroscope.getCurrent()
$deviceGyroscope.watch()
$deviceGyroscope.clearWatch()