Skip to content
Advertisement

How to show a notification without a sound java

How can I make a notification that doesn’t make a sound when I build it? I am building a notification, and my users don’t like the fact that it makes a sound.

How can I change it to a silent one / no sound at all?

How I show notification:

JavaScript

I tried to search on google, but the only results I get is HOW to play a sound, not HOW to not play a sound…

Edit It possibly is a duplicate in some people’s eyes, but in mine I could not find out an alternative for the there specified default, while this new method is called setDefaults

Advertisement

Answer

Remove the line to builder.setDefaults(Notification.DEFAULT_ALL);. It will not play the sound, but you may need to enable all other notification defaults if preferred

Advertisement