NotificationReceivedListener when app is closed

  1. SDK Version: 38
  2. Platforms(Android/iOS/web/all): Android

I am trying to open the app on a specific screen when my users tap a notification. I have seen several messages on this forum that say to simply use the Notification listener to handle it.

The problem is that listeners only work when the app is opened.

When it is closed, tapping the notification opens the app but does not trigger the listener added with addNotificationReceivedListener.

I have read that app’s root component receives the notification data from expo through its props. However, even though I do have an exp object in my props, it does not contain a notification object.

How can I react to the user tapping a notification when the app is closed?

For the most obscure reason this solution will let me receive the exp.notification in my root component props: javascript - handling expo push notifications when app is closed - Stack Overflow

Once the above solution worked, I can even revert it and it will keep on working.

Any idea why?

There is more. Notifications received while the app was in foreground were automatically dismissed (which is good). But since I applied the solution above, they aren’t anymore. Even though I have now reverted the app.json settings from said solution.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.