Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Cannot make notification silent #1858

Closed
@nastarfan

Description

@nastarfan

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",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions