Extended the cordova sensor plugin to work based on the TYPE_SENSOR
being an integer, instead of a string.
At this moment this plugin is implemented only for Android!
$ cordova plugin add https://github.com/theiotsuitcase/cordova-plugin-sensors.git
Enable sensor.
Disable sensor.
Get values sensor.
APP.controller("indexController", function ($scope, $interval){
function onSuccess(values) {
$scope.state = values[0];
};
document.addEventListener("deviceready", function () {
sensors.enableSensor(1);
$interval(function(){
sensors.getState(onSuccess);
}, 100);
}, false);
});
You can get the type of sensors from the plugin : https://github.com/theiotsuitcase/cordova-plugin-sensorlist
For more information about sensors Android see Android Sensors Overview