Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49188

Running app in background

$
0
0

@kimaniidaniel wrote:

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);
        };

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>