Cordova-plugin-local-notifications: Not fired cordova.plugins.notification.local.on("click", function (notification)

Created on 19 Aug 2016  路  8Comments  路  Source: katzer/cordova-plugin-local-notifications

when app is in foreground and notification come then i pull down notification bar from top and click on notification. then cordova.plugins.notification.local.on("click", function (notification) is not fired

bug question

All 8 comments

Here it is crashing the App

Have same issue

Hello, i tried it today and it works.
So, The ID of your local.on(... is the same of the local.schedule(..?.
Too, be sure you don't added a icon locale, happens a crash when we do this.

same problem in iOS, here the code

cordova.plugins.notification.local.schedule({
id: 123,
text: 'This is my notification',
sound: sound,
badge: 1
});

and the click...

cordova.plugins.notification.local.on("click", function (notification) {
alert("user clicked on notification");
});

try this too but does not work either

cordova.plugins.notification.local.on("click", function (notification) {
if (notification.id == 123) {
alert("user clicked on notification");
}
});

Any solution? It's not triggering the on "click" for me too, it just opens the app.

Please use v0.9-beta and/or reopen the ticket if its still an issue. Thanks

@katzer Hm... I'm on 0.9-beta.3 and it's not working:
The click event is only triggered, if the app has been running (in the background or foreground). But if it's started anew by tapping a notification it's not triggered.

Is there a specific time when I need to hook up this event or should it always replay once when the app has been started by a notification tap? (I upgraded ionic too - so maybe it's just that the first page is initialized later than when it used to be?)

I tried it with Android 7 & 8.

@katzer Ah sorry - forget what I wrote!
It was a simple case of RTFM: fireQueuedEvents and reading the data from cordova.plugins.notification.local.launchDetails on startup did the trick!
Thanks for your great plugin!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jomarocas picture jomarocas  路  3Comments

ThorvaldAagaard picture ThorvaldAagaard  路  3Comments

daniele-sartiano picture daniele-sartiano  路  4Comments

ashvin777 picture ashvin777  路  3Comments

neshke89 picture neshke89  路  4Comments