首页 > 解决方案 > 当应用程序在离子中关闭时如何调用函数

问题描述

我需要帮助,我不知道如何在应用程序关闭时在后台进行函数调用,它只有在打开或最小化时才有效。

platform.ready().then(() => { 
  this.backgroundMode.setDefaults({ silent: true });
  this.backgroundMode.enable();
  backgroundMode.on('enable').subscribe(() => { 
    setInterval(() => {
      this.getBusqueda();
    }, 5000);
  }); 

标签: ionic-frameworkbackground-mode

解决方案


推荐阅读