Accelerometer plugin of BlackHawk.
##Install
- Copy js/Accelerometer.js into www/plugins directory in your project.
- Drag swift/Accelerometer.swift into your Xcode project.
- add "Accelerometer" to the params of self.runPluginJS(["Base"]) in BlackHawkViewController class.
##Use
// js code
function accelerometerOnSuccess(acceleration) {
alert('Acceleration X: ' + acceleration.x + '\n' +
'Acceleration Y: ' + acceleration.y + '\n' +
'Acceleration Z: ' + acceleration.z + '\n' +
'Timestamp: ' + acceleration.timestamp + '\n');
};
function accelerometerOnError(e) {
alert(e);
};
// get current acceleration
navigator.accelerometer.getCurrentAcceleration(accelerometerOnSuccess, accelerometerOnError);
##LICENSE BlackHawk is open-sourced software licensed under the MIT license.
Copyright (c) 2015 Leqicheng Inc. 乐其橙科技(北京)有限公司