0
votes

When push notification to Android 8.0 App run in background , custom sound not working.

sound path : app/src/main/res/raw/siren_noise.wav

{

    "to" : "devices token",

    "notification" : {

        "body" : "Body of Your Notification",
        "title": "Title of Your Notification",
        "sound": "siren_noise",
        "android_channel_id": "7373737"

     }

}
1
you have to set Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); builder.setSound(alarmSound); and notificationmanager.notify(0, builder.build()); in your Android code. And also check theappguruz.com/blog/… and developer.android.com/training/notify-user/build-notification - Android User
Can i when receive notification sound is based on server push json sound name play the sound? Coz your code is custom notification not default notification. - kiat hee

1 Answers

-1
votes

Check out the firebase messaging official sample to set custom details to your notification, custom default icon, custom default color and sound

Firebase Cloud Messaging Quickstart