0
我试图在我的移动应用程序上实现本地noti操作。我可以成功安排通知,但无法获得“触发事件”。Ionic2,LocalNotification插件,触发事件不起作用
constructor(public platform:Platform, public nav:NavController, public navParams:NavParams,
public builder:FormBuilder, public menu:MenuController, public verify:VerifyToken) {
// after local noti alert trigger, badge number increases 1
LocalNotifications.on("trigger", (notification, state) => {
this.nav.present(alert);
// badge number increase 1.
Badge.increase(1);
});
// local push for alarming 30mins before reservation
LocalNotifications.on("click", (notification, state) => {
// badge number 0
Badge.clear();
let alert = Alert.create({
title: "scheduled!",
subTitle: "scheduled!",
buttons: ["OK"]
});
this.nav.present(alert);
});
}
scheduleAppointment() {
LocalNotifications.schedule({
title: "scheduled!,
text: "ready to go!",
at: moment(this.reservation.start).subtract(1800, 'seconds').toDate()
});
}
当时间到了,本地通知工作,但无法捕捉触发事件,因此徽章计数不会增加。如何解决此问题?提前致谢!