Listener not triggered when App is opened by a push notification

SDK 38 managed workflow.
Android/iOS.

Notifications.addNotificationResponseReceivedListener only triggers when user taps on push notification and the app is foregrounded or backgrounded.
If the app is opened by the push tap, then Notifications.addNotificationResponseReceivedListener is never triggered and then I have no way to handle the push.

I just upgraded from SDK37 (it used to work without issues) and I decided to also upgrade to “expo-notifications” as well.

Thank you in advance!

import * as Notifications from 'expo-notifications';

export default ({ navigation }) => {
    useEffect(()=>{        
        Notifications.setNotificationHandler({
            handleNotification: async () => ({
                shouldShowAlert: true,
                shouldPlaySound: false,
                shouldSetBadge: false
            })
        });
        Notifications.addNotificationResponseReceivedListener(handlePush);
        return () => {
            Notifications.removeNotificationSubscription();
        }
    },[]);

    const handlePush = async(response) => {
       // It only reaches this function when the App was foregrounded or backgrounded, but it never reaches here if the app was previously killed.
    }
    return null;
}

The same issue here

1 Like

Me as well - does anyone have an answer for this?

1 Like

Not yet :sweat:

It seems like the guys at Expo are working to fix the issue #6943.

Since this needs to stay open(!) I will ask- does anyone know how to get an issue moved up the stack? This was opened in February and STILL has no one assigned to it!
I can’t release my product until notifications work ;(
It would be good to know if I should roll back (ugh) if they intend to ignore it for another 5 months.

1 Like

Same issue here. This worked fine in the old (pre-SDK38) notifications package.

1 Like

Still no news. It is a bit frustrating, to be honest :frowning:

1 Like

Between this issue and this one “Expo notifications still displaying even after setNotificationHandler return false for shouldShowAlert on Android”, I’m seriously considering to turn off useNextNotificationsApi.

I wonder if that would fix the problem, or do we have to completely roll back to SKD 37 to have notifications that actually work?

Realize this is a little off-topic but is there anyone on this thread also experiencing other issues with notifications on 38 and useNextNotificationsApi?

Are you guys also able to hide the alerts in Android with shouldShowAlert?

I think it’s somehow all connected to v38 and useNextNotificationsApi.

I rolled back to the legacy notifications. (https://docs.expo.io/versions/v38.0.0/sdk/legacy-notifications/#notificationsaddlistenerlistener)

Now the Listener is invoked, but the Metro server connection keeps getting dropped.
Very frustrating.

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