0

i have integrated my app with Fire base and when i send cloud messaging it comes with no voice can you please help me as i am a beginner .

and i Do not know which file should be edited .

{
"to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",

"notification" : {
  "body" : "great match!",
  "title" : "Portugal vs. Denmark",
  "icon" : "myicon",
  "sound" : "mySound"
}

}

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

0

Use setSound() method to set your notification sound in your NotificationCompat.Builder

I use Kotlin, it will be like this

val defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
val notificationBuilder = NotificationCompat.Builder(this, channelId)
            .setSmallIcon(R.mipmap.ic_launcher)  
            .setContentTitle(message.data["title"]) 
            .setStyle(NotificationCompat.BigTextStyle().bigText(message.data["body"]))
            .setContentText(message.data["body"])
            .setSound(defaultSoundUri)
Erwin Kurniawan A
  • 958
  • 2
  • 9
  • 17