Asked
Modified
11 months ago
Viewed
470 times
Part
of Mobile Development and Google Cloud Collectives
I working on an iOS app for which I am required to change sound for push notifications. I am using Firebase Console to send notifications.
I put notification sound file in project and send its name in custom data through Firebase messaging in sound key. I found this solution after hours of searching but this solution doesn't seem to work. Is it even possible in iOS? If so how?
asked Dec 3, 2024 at 5:30
Abdullah Shahid
1111 silver badge11 bronze badges
-
This question is similar to: How to send Push Notifications with custom sounds via the Firebase FCM Console. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem.lazarevzubov– lazarevzubov2024年12月03日 06:30:22 +00:00Commented Dec 3, 2024 at 6:30
-
There are other similar questions on SO: stackoverflow.com/questions/58973180/…, stackoverflow.com/questions/39335363/…, stackoverflow.com/questions/38811615/…lazarevzubov– lazarevzubov2024年12月03日 06:31:20 +00:00Commented Dec 3, 2024 at 6:31
1 Answer 1
All you need to do are:
- Make sure you've added the sound file to your project. Double check it in
Project -> Build Phases. Supported types areaiff, wav, or cafas mentioned in this documentation UNNotificationSound.
- The push notification payload must have a
soundfield that matches with the file name from the previous step. In this case is"sound": "pushSound.wav". I've created a mockup in Push Notification Console. The payload should be something like:
{
"aps": {
"alert": {
"title": "Who's that?"
"body": "Ringgggg....."
}
"sound": "pushSound.wav" //<- here
}
}
It's supposed to work as usual if the project didn't include any Notification Extension.
answered Dec 3, 2024 at 7:06
sonle
10.4k3 gold badges17 silver badges31 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
Abdullah Shahid
This doesn't work if you are sending notifications using Messaging from Firebase console.
sonle
What is the payload that you received from FCM?
Explore related questions
See similar questions with these tags.
default