离子本地通知背景或已终止的应用

时间:2018-12-01 06:25:37

标签: ionic-framework

我创建了本地通知,并且当应用程序在屏幕上运行,应用程序进入后台或被杀死时,我都无法收到通知

 this.platform.ready().then(() => {
 let exp = new Date(this.expiration_date);
 let exp_date = new Date(exp);
 let today = new Date(new Date(exp));
 let data = moment(exp).format('YYYY/MM/DD');
 let data2 = moment(today).format('YYYY/MM/DD');
 var d = new Date(this.expiration_date.replace(/-/g, '/'));
 console.log(d);

 if (data == data2) {
 this.localNotifications.schedule({
  id: 1,
  title: 'myGym',
  text: 'Your subscription will expire today',
  trigger: {at: d},

});
}
});

0 个答案:

没有答案