2

I'm using BackgroundMode plugin in Ionic 4 and it works fine when I minimize the app, but I clean it form recent apps it stops sending data. Is there any way to keep it running?

app.component.ts

  initializeApp() {
    this.platform.ready().then(() => {
      this.statusBar.styleDefault();
      this.splashScreen.hide();
      this.backgroundMode.enable();
      this.backgroundMode.on('activate').subscribe(() => {
        console.log('activated background mode');
        this.backgroundMode.disableWebViewOptimizations();
      });
    });
  } 

1 Answers1

0

Just did some digging.

It seems that there is a manifest.xml option for Android:

<service
    android:name="com.myapp.MyService"
    android:stopWithTask="false" />

I would check out the linked question and this one for more information.

rtpHarry
  • 13,019
  • 4
  • 43
  • 64
  • Thanks for marking as answer. If it helped please consider upvoting as well, otherwise stackoverflow don't count it towards my Ionic4 badge. – rtpHarry Aug 27 '19 at 06:07