invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.66k stars 2.21k forks source link

🔥[Android >=8.0] Notifications: No Channel found (channelId) on newly created notification channel #1727

Closed ecexplorer closed 5 years ago

ecexplorer commented 5 years ago

Issue

In the same app session, if I create a new notification channel (and corresponding ID) using the api firebase.notifications().android.createChannel(), and then try to use that channel ID to display a notification firebase.notifications().displayNotification(), I get: E NotificationService: No Channel found for pkg=com.relaygo.spectre.companion, channelId=poke-3wWzrYhd6g3cQN6y, id=266221012, tag=null, opPkg=com.relaygo.spectre.companion, callingUid=10128, userId=0, incomingUserId=0, notificationUid=10128, notification=Notification(channel=poke-3wWzrYhd6g3cQN6y pri=1 contentView=null vibrate=null sound=null defaults=0x0 flags=0x11 color=0xff66cccc category=msg groupKey=poke-$all$ number=0 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)

As soon as I remove the app from memory (swipe it away), and bring it back into focus, it works just fine. I've also confirmed that as soon as I call createChannel(), the new notification channel properly shows in android settings. Based on looking at the code, I actually think this may be an Android bug, but confirmation & knowledge of where to report that would be helpful :)

Project Files

Environment

ecexplorer commented 5 years ago

Sorry, this was a blunder on my part, channel id was not being set as expected

adityajhordanbapr commented 5 years ago

Hi, @ecexplorer How you solve it ? I face the same problem right now, no luck for me :(

ecexplorer commented 5 years ago

In android, for every notification that you have, you have to assign it to a notification channel. Channels can be created using the Android-specific API. Look here: https://github.com/invertase/react-native-firebase-docs/blob/master/docs/notifications/android-channels.md After ensuring your channel exists (you can check this in Android Settings), you should be able to show a notification that is associated with that channel.