Saturday, 27 October 2018

No custom sound with Android Firebase Notification

I am using Firebase push notifications in my Android App. I can send correctly notification with custom icon, but I have not managed to play my custom sound. I always get the default sound of my device.

{
    "registration_ids": "myToken",
    "notification": {
        "body": "my body",
        "title": "my title",
        "icon": "ic_notification",
        "sound": "mysound.mp3" // I tried "mysound", "mysound.wav"...

    },
    "priority": "high"

}

The custom sound is located in /res/raw

I have been able to play my custom sound with onMessageReceived and Firebase data message but not with Firebase notification message.

My android device is Xiaomi Mi A1 and Oreo 8.1., also tried with Xiaomi Mi A2 with same result.

I tried with php and curl, with node.js... always same problem, I get my default sound.



from No custom sound with Android Firebase Notification

No comments:

Post a Comment