No custom sound with Android Firebase Notification

后端 未结 6 1534
轮回少年
轮回少年 2021-01-17 10:39

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

6条回答
  •  悲&欢浪女
    2021-01-17 11:28

    i was also facing the same issue. I always got the default sound but i fixed it as follows . I am using FCM-push (node module) https://www.npmjs.com/package/fcm-push

    var message = {  
    to : device_token,
    collapse_key : '',
    // data : {
    //     '' : '',
    //     '' : ''
    // },
    notification : {
        title : 'Title ',
        body : 'some Body',
        sound : 'notification' // my .ogg file in /res/raw
    },
    android: {
    sound: 'notification' // my .ogg file name in /res/raw
    }
    };
    

    I have not tried it with mp3 or wav and in your question it seems you have not tried with .ogg file ( though i doubt if it has anything to do with audio format but you can try)

提交回复
热议问题