-
Notifications
You must be signed in to change notification settings - Fork 4k
🐛 [firebase_messaging 8.0.0-dev.11] Custom Notification Sound not playing #4521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @momoDragon |
|
Also, there is no default notification sound that runs. Tested on emulator and also physical device. |
I can reproduce this on the latest master flutter doctor -v
Seems like this issue was #523 before but was closed due to the massive changes with the new dev version. There is also still no documentation for this feature yet on https://firebase.flutter.dev/docs/messaging/usage. Since this is still the case we can track it here. |
You have to use custom notification channel to have notifications with sound. |
@momoDragon, this appears to be an Android platform issue, specifically any device using Android API level >= 26 as referenced here. Are you able to confirm if it works on Android API 25? |
This comment has been minimized.
This comment has been minimized.
I have tested this using specific notification channels and it does not resolve the issue (specifically see example code in issue #6621).. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Any update of this issue? Is that in the roadmap? Create a notification channel just for use custom sounds isn't a good approach to workaround on this issue. |
ありがとうございました。 |
Already any update on this? |
Any update on this issue ? |
is there any update on this issue? |
Hey folks, this isn't something to be fixed at the level of FlutterFire. It is a change in how android api >=26 handles notifications. You can read more here. If you wish to have custom sounds for your notifications on Android api >=26, you have to create an Android notification channel which the flutter_notification_package specifically addresses. The notification channel needs to be referenced whenever you push a notification message. Example using REST API: {
"to": "device_token"
"notification": {
"title": "My First Notification",
"body": "Hello, I'm push notification"
},
"data": {
"title": "My First Notification"
},
"android": {
"notification": {
"channel_id": "channel_id_1" // NOTIFICATION CHANNEL ID WITH CUSTOM SOUND REFERENCE HERE
}
},
} |
@russellwheatley I am trying to leverage android channels as you mentioned, and am still seeing issues. Not sure if there is a bug here. Maybe this should be reopened. or is there a main firebase repo I could post this at? I am creating a notification channel that successfully shows up in my android settings, but no custom sound plays. The sound resource is present and there are no errors referencing it when creating the channel...
I am sending the notification based on the latest api docs...
|
@Turburlar try using channel_id instead of channelId in the payload. |
Uh oh!
There was an error while loading. Please reload this page.
I have added a file sound to this directory
and my payload for sending notification in cloud functions is
i also tried sound: 'alert.mp3',
However, the default notification sound is the one that is playing.
Any idea how i can get it to play a custom sound when notification is sent? am i doing something wrong?
i followed this:
https://stackoverflow.com/questions/54002617/custom-sound-push-notification-does-not-work-flutter
version:
firebase_messaging: ^8.0.0-dev.11
The text was updated successfully, but these errors were encountered: