Mentos Mentos - 3 months ago 116
iOS Question

Firebase push notifications custom sound

I am currently working on an app and I have implement firebase Push Notification service into my app. I am recieving notification on my iphone but I am unable to set the custom alert sound that I want.


  • I added the sound as a .caf

  • I added the sound to the
    Copy Bundle Resources



using
print (userInfo)
I have collected this data that is incomming from Firebase

aps: {
alert = {
body = MSG;
title = Title;
};
sound = default;}, {...}, sound: alarm.caf


I understand where the problem is, I just dont understand how to fix it so that the app plays my custom notification sound.

Firebase notification console IMG

Answer

After much research I have not found any solution. Under Firebase Messaging Docs, and

Table 2a. iOS — keys for notification messages

it is indicated that Firebase does allow for the Sound key to be included in the payload but as seen in the code printed by didRecieveRemoteNotification,

aps: {
alert =     {
    body = MSG;
    title = Title;
};
sound = default;}, {...}, sound: alarm.caf

Firebase doesn't include the Sound key inside the aps hence not calling the sound key by the app.

The workaround that I used for my app is Easy APNs Provider which is a handy and easy app to use for development purposes, a major issue is that it doesn't have the ability to register and remove notifications automatically.

lastly: for Push Notifications to my published apps, I have opted for a dedicated server which I run off of my website

Comments