How to show a notification without a sound java

To disable the sound in OREO 8.1, change the priority of the notification as LOW and it will disable the sound of notification:


The code is like:

NotificationChannel chan1 = new NotificationChannel("default", "default", NotificationManager.IMPORTANCE_LOW);

It works for me in Android Oreo.

You should just write your channel like this:

NotificationChannel notificationChannel = new NotificationChannel("Id" , "Name", NotificationManager.IMPORTANCE_DEFAULT);
            notificationChannel.setSound(null, null);