【发布时间】:2016-08-07 15:08:10
【问题描述】:
我正在尝试在我的移动应用上实现本地通知操作。我可以成功安排通知,但无法获得“触发事件”。
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()
});
}
到了时间,本地通知有效,但无法捕获触发事件,因此徽章计数不会增加。我该如何解决这个问题?提前致谢!
【问题讨论】:
标签: triggers ionic2 localnotification