How to handle notifications when the app is closed?

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

I have tried the following solution and added this code outside of my App component:

Notifications.addNotificationResponseReceivedListener((response) => {
	console.log({response});
});

Notifications.addNotificationReceivedListener ((response) => {
   console.log({response});
});

Unfortunately, when the app is closed and I tap a notification, the app opens but none of these logs are displayed. Am I missing something?

2 Likes

No you’re not missing something here. As far as I know it’s not possible to “react” to notifications when the app is closed. You would have to eject for that functionality.
You can have a look here https://docs.expo.io/introduction/why-not-expo/#limitations-of-the-managed-workflow

My issue is that I’m not getting any notifications when the app is closed. My notification works if the app is open but when it is closed I did not get any notification as expected.

The notification is triggered by the date so it’s a scheduled notification. I have another thread on this on this form but I just wanted to get your opinion. I have been told that the best option is to use task manager and background task manager.

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