React native firebase messaging notification sound not change in background

Viewed 1006

i am using @react-native-firebase/messaging for push notification in my application. and for custom notification sound i use @notifee/react-native this.

my current notification code is :

import messaging from '@react-native-firebase/messaging';
import notifee from '@notifee/react-native';

await notifee.createChannel({
      id: 'custom-sound',
      name: 'System Sound',
      sound: 'notification.mp3',
});

messaging().onMessage((remoteMessage) => {
      notifee.displayNotification({
        title: remoteMessage.notification.title,
        body: remoteMessage.notification.body,
        android: {
          channelId: 'custom-sound',
        },
      });
});


the above code works fine when the application is open on the screen so that my custom notification sound works perfectly.

but when the app is running in the background then the notification sound is the default (system default)

so how i can set the custom notification sound in all cases.

This my notification payload

1 Answers

Sound related to the channel so delete your channel (custom-sound) and recreate it. Once channel created you can not edit the android channel so if you are going to edit a channel you need to delete and recreate it.

Related