我使用OneSignal在Ionic 3 APP中发送接收通知。
我的代码是(完美运作)
this.oneSignal.startInit(Config.oneSignal.appId, Config.oneSignal.firebaseSenderId);
this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.None);
this.oneSignal.handleNotificationReceived().subscribe((data: any) => {
const attempt = data.payload.additionalData.attempt;
if (data.isAppInFocus) {
this.presentModalDefense(attempt);
this.oneSignal.cancelNotification(data.androidNotificationId);
} else {
this.badge.increase(1).then(data => {
console.log(data);
});
}
});
this.oneSignal.handleNotificationOpened().subscribe((data: any) => {
const attempt = data.notification.payload.additionalData.attempt;
if (!data.isAppInFocus) {
this.attemptProvider.howLongTimeAgo(attempt.id).subscribe((timeago: any) => {
let config = this.auth.getConfig();
if (timeago.seconds >= config["SPEED_TO_ROB"].value) {
this.presentModalUnsuccessfulDefense(attempt);
} else {
this.presentModalDefense(attempt, timeago.seconds);
}
}, err => {
});
}
});
this.oneSignal.endInit();
我的问题是
我想拨打this.oneSignal.handleNotificationOpened()
(对于尚未处理的所有待处理通知)
有人知道怎么做吗?