zo0r / react-native-push-notification

React Native Local and Remote Notifications
MIT License
6.75k stars 2.05k forks source link

Create a specific LocalNotification to silent #2340

Closed AdrianFAlejo closed 1 year ago

AdrianFAlejo commented 1 year ago

First, I created a notification channel that has default parameters except for the soundName

PushNotification.createChannel({
    channelId: `My_Channel`, // (required)
    channelName: `Test_Channel`, // (required)
    soundName: null, // (optional) See `soundName` parameter of `localNotification` function
    vibrate: true, // (optional) default: true. Creates the default vibration patten if true.
});

then I show a specific notification and I want it to be silent one

PushNotification.localNotification({
  /* iOS and Android properties */
  channelId: `My_Channel`,
  title: 'Test Notification',
  message: 'Test', 
  playSound: false, 
  soundName: null 
});

I already set the playSound and soundName into false and null but whenever I receive a notification it plays a default notification sound. How do I make that specific notication silent?

trinhnguyen81 commented 1 year ago

you should set playSound : false in createChannel

AdrianFAlejo commented 1 year ago

you should set playSound : false in createChannel

I'm trying to send multiple notification on that channel and some notification has sound and some is muted so that's why I want the localNotification parameters override the parameters in that created channel

trinhnguyen81 commented 1 year ago

you should set playSound : false in createChannel

I'm trying to send multiple notification on that channel and some notification has sound and some is muted so that's why I want the localNotification parameters override the parameters in that created channel

I got same issue before you have to create 2 channels, 1 for silent and 1 for audio