Hi guys,
I want to use the Pedometer cordova plugin for iOS 8+ => https://github.com/leecrossley/cordova-plugin-pedometer
But it is not loading from ngCordova.
My controller:
angular.module('starter.controllers', [])
.controller('PedometerCtrl', ['$scope', function ($scope) {
var successHandler = function (pedometerData) {
$scope.steps = pedometerData.numberOfSteps;
// pedometerData.distance;
// pedometerData.floorsAscended;
// pedometerData.floorsDescended;
};
var onError = function (error) {
console.log("ERRO! " + error);
}
pedometer.startPedometerUpdates(successHandler, onError);
}]);
The plugin source:
var exec = require("cordova/exec");
var Pedometer = function () {
this.name = "Pedometer";
};
Pedometer.prototype.isStepCountingAvailable = function (onSuccess, onError) {
exec(onSuccess, onError, "Pedometer", "isStepCountingAvailable", []);
};
Pedometer.prototype.isDistanceAvailable = function (onSuccess, onError) {
exec(onSuccess, onError, "Pedometer", "isDistanceAvailable", []);
};
Pedometer.prototype.isFloorCountingAvailable = function (onSuccess, onError) {
exec(onSuccess, onError, "Pedometer", "isFloorCountingAvailable", []);
};
Pedometer.prototype.startPedometerUpdates = function (onSuccess, onError) {
exec(onSuccess, onError, "Pedometer", "startPedometerUpdates", []);
};
Pedometer.prototype.stopPedometerUpdates = function (onSuccess, onError) {
exec(onSuccess, onError, "Pedometer", "stopPedometerUpdates", []);
};
module.exports = new Pedometer();
Thanks!
-Vitor