Running app in background


#1

HI, I’m trying to have my app poll my server API for new information every min. I tried using Angular1 and iconic 1 with this plugin - https://ionicframework.com/docs/v2/native/background-mode/. I tested the app in Ionic View, pressed the home button and I get no notification. I did this simple test (see below code) where the app is supposed to wait 5 seconds when in background then show a notification. Here’s my code. What could be the problem?

$cordovaBackgroundMode.onactivate = () => {
            $scope.home.intro_text = "activated<Br>";
            setTimeout(function () {
                // Modify the currently displayed notification
                cordova.plugins.backgroundMode.configure({
                    title: 'Netherlands RSA',
                    resume: true,
                    isPublic: true,
                    text: 'Running in background for more than 5s now.'
                });

                $cordovaLocalNotifications.schedule({
                    id: 1,
                    text: 'Testing',
                });
                $scope.home.intro_text += "set timeout launched<BR>";
            }, 5000);
        };