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.
To configure expo-notifications , use the built-in config plugin in the app. json or app. config. js for EAS Build or with npx expo run:[android|ios] .
To turn on the setting for a development device running Android 8.0 (API level 26), navigate to Settings > Developer options and enable Show notification channel warnings.
The ExpoPushToken will never "expire" but if one of your users uninstalls the app, you'll receive a DeviceNotRegistered error back from Expo's servers, meaning you should stop sending notifications to this app.
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.
You have created your channel successfully but doesn't updated your app's expo notifications settings. For this you must add -
android: {
...
"useNextNotificationsApi": true
}
in your app.json
file.
Then just run your code by clearing expo cache like -
expo start -c
And test it! You will start receiving the notifications on your Android 10+ mobiles also.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With