Custom Sound is not getting played after added in configuration also in react-native-push-notification

Viewed 268

Here's my code below. I have added soundName value to sound file name. I have added sound file to 'raw' folder in android directory. But still it is playing default notification sound.

  PushNotification.localNotification({

        /* Android Only Properties */
        channelId: 'default-channel-id',
        autoCancel: true, 
        largeIcon: 'ic_launcher', 
        smallIcon: 'ic_launcher', 
        color: 'red', 
        vibrate: true, 
        vibration: 300, 
        tag: 'some_tag', 
        group: 'group',
        groupSummary: false, 
        ongoing: false,
        actions: null,
        invokeApp: true,
        when: null,
        usesChronometer: false,
        timeoutAfter: null,

        /* iOS only properties */
        category: '',

        /* iOS and Android properties */
        id: this.lastId,
        title: config.title,
        message: config.message,
        userInfo: {screen: 'home'},
        playSound: true,
        soundName: 'sound_one.mp3',
        number: 10,
    });
1 Answers

This issue is resolved by creating channel with custom soundName. While creating channel you must define soundName if you want custom sound and add sound file in 'raw' folder. After defining custom sound you have to reinstall the application.

Related