1

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
2

1 Answer 1

1

All you need to do are:

  1. Make sure you've added the sound file to your project. Double check it in Project -> Build Phases. Supported types are aiff, wav, or caf as mentioned in this documentation UNNotificationSound.

image1

  1. The push notification payload must have a sound field 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
Sign up to request clarification or add additional context in comments.

2 Comments

This doesn't work if you are sending notifications using Messaging from Firebase console.
What is the payload that you received from FCM?

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.