Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29438

React native firebase notification sound for call/alarm notification category

$
0
0

I am using react-native-firebase for a voice call app. I tried to create an incoming call notification as below:

const notification = new firebase.notifications.Notification()
    .setTitle("Incoming call")
    .android.setAutoCancel(true)
    .android.setCategory("call")
    .setSound('default')
    .setBody("Test User");


const channel = new firebase.notifications.Android.Channel('test-channel', 'Test Call Channel', firebase.notifications.Android.Importance.Max)
                .setDescription('Test call channel')
                .setSound('default');

firebase.notifications().android.createChannel(channel);

notification.android.setChannelId(channel._channelId)
            .android.setSmallIcon('ic_launcher');

firebase.notifications().displayNotification(notification);

But still, the notification sound is default message notification sound. Also tried changing the category as "alarm". Also tried adding an mp3 file in "res/raw" folder and used setSound("ring.mp3")

package.json details:

{
.
.
"react-native-firebase": "^5.6.0",
"react": "16.9.0",
"react-native": "0.61.5",
.
.
}

Can anyone help with this?


Viewing all articles
Browse latest Browse all 29438

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>