[expo-notifications] iOS can't get notification object in NotificationReceived nor NotificationResponseReceived

SDK 45
Development build (no Expo Go)

Hi! On iOS, when receiving a notification in the foreground I can’t get the notification object in NotificationReceived nor NotificationResponseReceived.

I have setup addNotificationReceivedListener and addNotificationResponseReceivedListener and no mater what, if I receive a notification in the foreground, I can’t get the notification console logged, and if I tap a notification nothing gets logged either!

This is my partial setupNotifications.js file:

...
...
Notifications.setNotificationHandler({
  handleNotification: async () => ({
    shouldShowAlert: true,
    shouldPlaySound: true,
    shouldSetBadge: false,
  }),
});

export default function setupNotifications() {
  const notificationListener = useRef();
  const responseListener = useRef();

  useEffect(() => {
...
...

    // This listener is fired whenever a notification is received while the app is foregrounded
    notificationListener.current = Notifications.addNotificationReceivedListener((notification) => {
      console.log('Received a notification in the foreground!', Platform.OS, notification); // No logs at all!
    });

    // This listener is fired whenever a user taps on or interacts with a notification (works when app is foregrounded, backgrounded, or killed)
    responseListener.current = Notifications.addNotificationResponseReceivedListener((response) => {
      console.log('Received a notification response!', Platform.OS, response); // No logs at all!
    });

    return () => {
      Notifications.removeNotificationSubscription(notificationListener.current);
      Notifications.removeNotificationSubscription(responseListener.current);
    };
  }, []);
...
...
...
}

Well, seems that the issue solved after a development pc reboot. Will update if the error appears again

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