androidreact-nativeexpoexpo-notifications

Expo notifications not working when channel id is used


I am using the following code to create two channels for my expo react app, on Android:

Notifications.setNotificationChannelAsync("default", {
            name: "default",
            importance: Notifications.AndroidImportance.MAX,
            vibrationPattern: [0, 250, 250, 250],
            lightColor: "#FF231F7C",
        })  

Notifications.setNotificationChannelAsync("gameupdates", {
                name: "gameupdates",
                importance: Notifications.AndroidImportance.MAX,
                vibrationPattern: [0, 250, 250, 250],
                lightColor: "#FF231F7C",
            })

The channel is successfully created and I can even find it when I go into the Expo app notification options.

When I send a notification using expo's tool without any channel id, it works fine. However, when I use the channel id "gameupdates", the notification never reaches my phone.

Any idea why?

I am on the expo sdk 38.


Solution

  • Fixed it! The issues was that I needed to add android.useNextNotificationsApi: true to the app.json. Then I had to do expo:build and manually upload the build.