question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot make notification silent

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Dallas62commented, Feb 11, 2021

Hi @eyalyoli I published a release to fix your issue. Regards,

2reactions
nastarfancommented, Feb 11, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control notifications on Android - Google Support
Silent : Your phone won't make a sound or vibrate. But the notification will show up when you swipe down from the top...
Read more >
How to set an Android app's notifications to silent
How to silence notifications via settings · Open the Settings app. · Go to Notifications. · Tap App settings. · Select the app...
Read more >
How to Fix Android Messages Having No Notification Sound
Open the “Messages” App · Tap the three dots in the upper right to open the menu, then select Settings · Tap the...
Read more >
Use Do Not Disturb with Focus on your iPhone or iPad
Go to Settings > Focus. Tap Do Not Disturb. You can select allowed or silenced notifications from people and apps, connect your Lock...
Read more >
What Are Silent Notifications? - iZooto
Silent notifications are notifications that do not make any sound or alert the user when it arrives, but it gets displayed only in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found