Hello Guys,
Could someone please show how to set a watch on $cordovaDeviceOrientation and automatically update values at frequent intervals?
I tried this code snippet and it updates only on function call. Any help would be highly appreciated.
$scope.options = {
frequency: 3000,
filter: true
}
$scope.myFunction = function () {
var watch = $cordovaDeviceOrientation.watchHeading($scope.options).then(
null,
function(error) {
},
function(result) {
$scope.magneticHeading = result.magneticHeading;
$scope.trueHeading = result.trueHeading;
$scope.accuracy = result.headingAccuracy;
$scope.timeStamp = result.timestamp;
});
};
Thanks in advance.