从最近的应用程序中清除后,是否可以将应用程序 运行 保留在后台?

Is it possible to keep an application running in background after being cleaned from recent apps?

我在 Ionic 4 中使用 BackgroundMode 插件,当我最小化应用程序时它工作正常,但我最近清理了它停止发送数据的应用程序。有什么办法可以保留吗运行?

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

刚刚some digging.

Android似乎有一个manifest.xml选项:

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

我会查看链接的问题和 this one 了解更多信息。