Help with Notification Channels

Please provide the following:

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

Hi,

I’m trying to get the notification channels to work for my expo app. However I had no luck with it so far. Every time I send a notification via the expo notification tool it won’t get delivered when I specify a channel.
The expo app however shows the the matching channel under the notification settings.
I’m trying to set up the channel the following way:

const testChannel: NotificationChannelInput = {
            name: 'testchannel',
            importance: AndroidImportance.MAX,
            bypassDnd: false,
            description: 'testchannel',
            lightColor: MAIN_THEME_ORANGE,
            lockscreenVisibility: AndroidNotificationVisibility.PUBLIC,
            showBadge: true,
            enableVibrate: true,
            enableLights: true,
            vibrationPattern: [250, 250]
        }

        const res = await setNotificationChannelAsync('testchannel', testChannel);
        if (null === res) {
            console.warn('Could not set NotificationChannel')
        }

This piece of code gets executed when starting the app and shows no errors.

If I don’t specify a channel the notification is delivered without any problems.
Any suggestions?

Hey @rooib,

https://docs.expo.io/guides/notification-channels/#creating-and-using-channels My first thought, per the bottom of this section, is that there is some issue with either creating the channel or how you are configuring the notification payload.

If the channel is not detected on the device, the notification won’t be delivered. Can you share how you are sending the notification with all the relevant code?

Cheers,
Adam

Hi @adamjnav,

thanks for the reply. It seems like if forgot to add the new useNextNotificationsApi flag in the app.json. Now it works on my friends phone but not on mine. But that is good enough. Maybe I broke some things while troubleshooting.

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