react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

reading push notification data after tapping on one in device's notification-list.

Open Crare opened this issue 3 years ago • 2 comments

Question

What does mean popping notification? does it mean removing them from delivered notifications array? If so, setting config popInitialNotification to false doesn't work, if I understand it right. Because opening app by tapping the notification removes still the notification and it is not shown in the list of delivered notifications inside the app. If on the other hand you open the app any other way, it will have the notification in the delivered notifications array.

I would like to read the notification data, when the app is opened by tapping the notification. Is this possible? I am using remote notifications, if that matters.

onNotification is only called when the app is in foreground. this is not useful in this case.

Crare avatar May 05 '22 11:05 Crare

okay got the notifications triggering right so that onNotification is triggered when app is opened by tapping the notification. I was missing the channel in AndroidManifest.xml.

There's still issue where I can't get the data of the actual notification when the onNotification triggers, but I can get the data when app is opened other way while there's notifications and notification data is shown in the delivered notifications array.

PushNotification.getDeliveredNotifications(notifications => { console.log('Delivered Notifications in onNotificationReceived ', notifications); });

also disabling popInitialNotification in config does nothing still.. it still removes the notification from app notificationcenter and from the delivered notification array.

Crare avatar May 05 '22 12:05 Crare

So when the app is on the foreground and receives push notification, it contains the data, but if the app is opened by tapping push notification the data is not there. Also it's not available in that case from the deliveredNotifications, because it's popped out from there whenever tapping a puhsnotification in notificationcenter..

Crare avatar May 05 '22 13:05 Crare

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 07 '23 00:05 github-actions[bot]