Hi
@zo0r
How can I differentiate notification receive and notification click event
Here I am trying, on notification click move to specific page but if I get any remote notification/click on that notification it goes to
onNotification: function(notification) {
}
Is it possible to know notification open
@zo0r i am having the same problem with differentiating the incoming pushes if it receive and clicked . thanks
@zo0r Any help regarding this issue would be really appreciated.
Oh it worked! Notification object passes a property "foreground" . If its true that means the notification was received while the app was open! Otherwise it was clicked.
@mohitpanjwani what if you clicked the app on the drawer . it will be handled same as when you clicked the notification from the status bar because they are both coming from foreground
@satishkumarkt @xphaul @mohitpanjwani cc
https://github.com/zo0r/react-native-push-notification/issues/122#issuecomment-233709484
I'm having a similar problem. The following is supposed to create a notification when one is received from the server, but if the user clicks on it, it opens another identical one.
onNotification: function(notification) {
PushNotification.localNotification({
message: notification.message
});
}
Is this an incorrect way of display notifications when they're received?
@strwbrry
onNotification: function(notification) {
const clicked = notification.userInteraction
if (clicked){
//do smth
} else {
PushNotification.localNotification({
message: notification.message
})
}
Thanks @zo0r
After update it(notification.userInteraction) works.
Thanks to all comment on this issue
Most helpful comment
@strwbrry