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"
}
}
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.