Cannot make notification silent

Question

Hi, I’ve been trying to make a notification that doesn’t make any sound, but couldn’t accomplish it since the library uses channel system on Android.

Ideally I’d like to control the soundName and playSound configuration of the notification through notification configuration object, but apparently on Android it’s now bound to the channel configuration. So to have different values for soundName it should be done by providing separate channel for each value.

However, one thing that I can’t do is disabling the sound of the notification, even tho I explicitly set the value when creating the channel

PushNotification.createChannel({
    channelId: 'channelidhere', // (required)
    channelName: 'channel name', // (required)
    playSound: false,
    soundName: 'default', // (optional) See `soundName` parameter of `localNotification` function
    importance: 4, // (optional) default: 4. Int value of the Android notification importance
  });
PushNotification.localNotification({
      channelId: 'channelidhere',
      title: 'Test',
      message: 'Test',
      playSound: false,
    });

it seems that the playSound property is disregarded, since the notification would still come with a sound.

The only way that I can disable the sound is by setting the importance to low (2), but this makes the notification heads-up doesn’t appear. Is there a way to properly disable the sound while still showing the notification heads-up?

platform: Android
“react-native-push-notification”: “^6.1.1”,

2 thoughts on “Cannot make notification silent

  1. hi @Dallas62 many thanks for your help! updating to the new version solves the issue. Sorry I didn’t notice the change in changelog, that’s why I didn’t update.

    Apparently there’s another issue raised by other user, I’ll keep this issue opened

Comments are closed.