🐛 [firebase_messaging:11.4.0] Custom push notification sounds not working for MacOS
As title. Works for iOS so it's not a server issue.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.3.1 21E258 darwin-arm, locale en-NO)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.67.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
@ollydixon Can you provide a minimal code sample along with sample payload you are sending that contains the custom sound file ?
@darshankawar thanks for replying.
This is for both Android and MacOS now, works for iPhone.
Setup
NotificationSettings settings = await FirebaseMessaging.instance.requestPermission(
alert: true,
announcement: false,
badge: true,
carPlay: false,
criticalAlert: false,
provisional: false,
sound: true,
);
2 Steps for Android
- .mp3 inside the res/raw under main for Android.
- Then you send the push notification with the sound option.
For MacOS it's the same steps as for iPhone.
Via the server, Android gets push notifications but no custom sound is played. Same with MacOS.
const message: MulticastMessage = {
data: {
type: data?.type ?? "no-data",
jsonString: data?.jsonString ?? "no-data",
},
notification: {
title: removeMd(title),
body: removeMd(desc),
},
android: {
notification: {
notificationCount: 1,
sound: "message_received.mp3",
},
},
apns: {
payload: {
aps: {
badge: 1,
sound: "message_received.caf",
},
},
},
tokens: fcmTokens,
};
I followed random steps online since I couldn't find any docs for this.
Thanks for the quick update. Since you mentioned it is occuring on Android as well, can you take a look at this and see if it helps ?
(Android related)
@darshankawar yeah, for Android there's no documentation on how to actually use the raw asset. The following won't compile as there's also never an option to add new resource assets in Android studio for Flutter projects.
(Android not working) Add
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
// (String.xml, this value matches the notification value from the server.)
android:value="@strings/default_notification_channel_id"
android:resource="@raw/message_received.mp3"/>
Then place the raw asset here

It doesn't fire the sound. No matter if I match the channel inside the push notification string from the server.
I have to manually register with local notification package which isn't good.
@darshankawar reguarding MacOS we took exactly the same steps as iOS. Still no luck, we get the default sound.
Thanks for the update and details.
For Android, can you try using something like below and see if it helps ?
"notification": {
"channel_id":
For further reference: https://github.com/firebase/flutterfire/issues/4521#issuecomment-1040362540
for Android there's no documentation on how to actually use the raw asset
Maybe try to implement as mentioned https://github.com/firebase/flutterfire/issues/7787#issue-1094243406 and see if it helps.
@darshankawar yes I already tried that; it doesn't work. It works when I use a different notifications library so FCM is broken with Android also.
Reguarding MacOS, did you have any ideas about that?
Thanks for the update. I think for Android, there still seems to be an issue per https://github.com/firebase/flutterfire/issues/4521 and https://github.com/firebase/flutterfire/issues/4521#issuecomment-1065319294, so probably that's the reason why you aren't able to see the same working at your end.
I tried to find documentation on how exactly to use custom notifications sound on macOS or are there any different steps to configure it, because I can't seem to get it working for some reason, which I'll try to dig deep into and see if it leads me to something worth that I can share it here.
Meantime, I'll keep this issue open and label for further insights from the team.
/cc @russellwheatley
any info about this issue? I'm not able to reproduce custom chime on macos
@ollyde @csandovalgt @darshankawar I am struck at an issue related to FCM with MacOS #12525 can u please help me with it