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 th
Finally I found the solution. For Android 8.0 and higher it's necessary to create a notification channel in your App:
NotificationChannel channel = new NotificationChannel('my_id', name, importance);
(more info: https://developer.android.com/training/notify-user/channels#java)
Then when you send the notification:
var registrationToken = 'xxxxxx';
var message = {
notification: {
title: 'my title',
body: 'my body',
},
android: {
ttl: 3600 * 1000,
notification: {
color: '#ff0000',
sound: 'mysound.mp3',
channel_id: 'my_id' // important to get custom sound
}
},
token: registrationToken
};