cordova-plugin-local-notifications: Local notifications not trigger or click when app is closed or killed
Your Environment
- Plugin version:
- Platform: ios
- OS version:13.0
- Device manufacturer / model: Apple
- Cordova version :9.0.0
- Cordova platform version : ios 5.0.1, android 8.1.0
- Ionic Version :5.4.1
Expected Behavior
Local notifications trigger or click when app is closed or killed
Actual Behavior
Local notifications showed but it’s not trigger or click when app is closed or killed, it just work only app open or run background
Context
(<any>window).skipLocalNotificationReady = true;
this.platform.ready().then(() => {
this.backgroundMode.enable();
this.localNotifications.on('click').subscribe(res => {
alert("click notification")
});
this.localNotifications.on('trigger').subscribe(res => {
alert("trigger notification")
});
this.localNotifications.fireQueuedEvents();
})
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 2
- Comments: 15 (1 by maintainers)
@Guy-Sela I tested on iOS. But to answer simply your question: Yes
the trigger event(the click will if correctly setup) will NOT fire afterwards by launching or anything - only if you had the app in foreground.At least in my test application where I thought I could depend on this. I could not. Also wrote in my answer how you could do this yourself. For me I had to schedule notifications for 3 days and also needed to have 2 queues. The ones which are to be fired and the ones which should be fired. There is a limit of 64 local notifications which can be scheduled.