I am making interval that run function get wifi info and send to database it's work fine when open app . plugin-background-mode working and show text "Myapp1 running in background" but function doesn't work.
app.js
.run(function($ionicPlatform, $ionicHistory){
$ionicPlatform.ready(function () { ...
cordova.plugins.backgroundMode.enable(); //enable background mode as default
cordova.plugins.backgroundMode.setDefaults({ //Modify the display information
title: 'Myapp1',
text: 'Myapp1 running in background'
})
})
controller.js
.controller('DashCtrl',function(....) {
$scope.$on('$ionicView.enter', function() {
$scope.getWifiInfo = function(){...}
.
.
.
$interval($scope.getWifiInfo, 20000);
.
.
.
});
});
I tried to put function into
cordova.plugins.backgroundMode.onactivate = function () {}
but still didn't work