Push notification broke after upgrading expo to 32.0.0

On expo 31 push notification worked but after upgrade to 32 it does not work. I have code from docs that checking for permissions, if no permission then ask. If permission granted check if expo push token is changed or not yet generated and if so, save it to database(firebase RTDB). I tried to send notification via “Expo - Push notification tool” but i didn’t receive any notification. Am i missing something or is it Expo issue?

export const handlePushNotification = () => async () => {
    const { status } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
    let finalStatus = status;

    if (status !== 'granted') {
        const { status: askedStatus } = Permissions.askAsync(Permissions.NOTIFICATIONS);
        finalStatus = askedStatus;
    }
    if (finalStatus !== 'granted') return;
    const token = await Notifications.getExpoPushTokenAsync();

    getCurrentUserPushToken()
        .then((expoPushToken) => {
            if (expoPushToken !== token) {
                saveCurrentUserExpoPushToken(token);
            }
        })
        .catch((error) => {
            log(error);
        });
};
1 Like

Hey @kurwaman,

Is this occurring on both android and iOS? Also, is this occurring in the Expo Client or a Stand-alone app?

Cheers,
Adam

I’m having the same issue, I believe. It seems really similar to the issue that happened last August that was fixed. I haven’t built on Android yet, but on iOS, in a stand-alone app I have in testflight, running the code from the push notification documentation returns this:

{
    "status":"undetermined",
    "expires":"never",
    "permissions": {
        "notifications": { 
            "expires":"never",
            "allowsAlert":true,
            "allowsBadge":true,
            "allowsSound":true,
            "status":"undetermined"
        }
    }
}

from the call to Permissions.getAsync(Permissions.NOTIFICATIONS) after having accepted push notifications in the prompt already.

Problem solved after adding Firebase Cloud Messaging server key to Expo.

I do see the issue from 29+ versions on IOS devices. Android I do not see issue.

Here is similar issue reported https://github.com/expo/expo/issues/2648

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