【问题标题】:Background Fetch Ionic configuration后台获取离子配置
【发布时间】:2017-08-23 15:32:28
【问题描述】:

我正在使用 Ionic Background Fetch 插件,正如它在 https://ionicframework.com/docs/native/background-fetch/ 所说的那样,但我遇到的问题是我没有办法配置应该在用户的黄金时间作为文档执行的回调函数说。

const config: BackgroundFetchConfig = {
  stopOnTerminate: false, // Set true to cease background-fetch from 
operating after user "closes" the app. Defaults to true.
   };

backgroundFetch.configure(config)
 .then(() => {
     console.log('Background Fetch initialized');

     this.backgroundFetch.finish();

 })
 .catch(e => console.log('Error initializing background fetch', e));

应该在哪里提供回调函数?配置函数只接受一个参数“config” 有没有人可以让它工作? 提前致谢!

【问题讨论】:

    标签: ionic-framework background-fetch


    【解决方案1】:
    const config: BackgroundFetchConfig = {
    stopOnTerminate: false, // Set true to cease background-fetch from 
    operating after user "closes" the app. Defaults to true.
     };
    
    backgroundFetch.configure(config)
    .then(() => {
     console.log('Background Fetch initialized');
    

    这里

     this.backgroundFetch.finish();
    
    })
    .catch(e => console.log('Error initializing background fetch', e));
    

    【讨论】:

    • 应该放在哪里?就像在 app.module.ts 的构造函数中一样?
    猜你喜欢
    • 2016-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-17
    • 2016-04-29
    • 2013-03-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多