A Cordova plugin that detects and watch motion API.
cordova plugin add https://github.com/mrameezraja/cordova-plugin-motion-activity
- cordova.plugins.motionActivity.requestUpdates
- cordova.plugins.motionActivity.stop
window.cordova.plugins.motionActivity.requestUpdates(function success(readings) {
console.log(JSON.stringify(readings));
// sample output
// { 'confidence': 2, 'unknown'; 0, 'stationary': 1, 'walking': 0, 'running': 0, 'cycling': 0, 'automotive': 0 }
}, function(error){
console.log(error);
})
window.cordova.plugins.motionActivity.stop(function success() {
console.log('motion detection stopped');
}, function(error){
console.log(error);
})
- IOS
- Android (In Progress)