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

mute sound for local notification not working #1045

Closed
roysG opened this issue Apr 13, 2019 · 9 comments
Closed

mute sound for local notification not working #1045

roysG opened this issue Apr 13, 2019 · 9 comments
Labels

Comments

@roysG
Copy link

roysG commented Apr 13, 2019

I tried to change the value playSound to "false" but the notification sound is still on.
What should i do?

@cristianoccazinsp
Copy link
Contributor

Facing the same issue. Local notifications always have sound AND vibration; can't mute them. Any thoughts?

@cristianoccazinsp
Copy link
Contributor

Most likely related to the importance/priority flags. Since priority was deprecated, and notification channel importance is now used, based on the notification channel importance the notification can or not play sounds. This is from testing a notification channel with a foreground service. However, I wasn't able to mute the notification even with a low importance/priority.

@Shoaib-Raza
Copy link

Any update on this issue.
I am also facing the same issue, i want to mute the sound but playSound = false doesn't work.

@necto68
Copy link

necto68 commented Sep 5, 2019

#1140 (comment)

@greenais
Copy link

greenais commented Jan 9, 2020

The same issue here.
I expect my users to be disturbed by such inflexibility(

@dgreasi
Copy link

dgreasi commented Nov 4, 2020

Facing same issue here.

Versions:
"react-native-push-notification": "^6.1.2",
"react-native": "0.63.2",

Any updates?

@dgreasi
Copy link

dgreasi commented Nov 4, 2020

I actually found a workaround that is working on android but it will be also a silent notification, which means it will not be visible if you dont open your notifications tray.

In my case is what i wanted

On the createChannel you need to specify a low importance. Thus the working code for me:

PushNotification.createChannel(
    {
      channelId: 'silent-notification',
      channelName: 'A silent notification channel,
      importance: 2, // < 3 seems to do the job
      vibrate: false,
      soundName: undefined, // works even if it is not specified
    },
    (created) => console.log(`createChannel returned '${created}'`),
  );

The function that i use to trigger my local notification:

export const showNotification = (
  title: string,
  message: string,
  isSticky: boolean = false,
  soundName = 'default',
  isSilent = true,
) => {
  PushNotification.localNotification({
    title,
    message,
    channelId: 'silent-notification',
    ongoing: isSticky,
    vibrate: !isSilent,
    playSound: !isSilent,
    soundName,
    smallIcon: 'ic_notification_video',
    largeIcon: 'bootsplash_logo',
  });
};

@sonnd08
Copy link

sonnd08 commented Nov 5, 2020

The same issue

@github-actions
Copy link

github-actions bot commented Nov 6, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Nov 6, 2021
@github-actions github-actions bot closed this as completed Dec 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants