NotificationChannel always make sound in Android 8.0

1.2k Views Asked by At

I have upgraded target build version to 27 so need to implement notification channel. I'm starting a foreground service which will show a notification when started. With notification channel it's working as expected but it's always make sound. Changing the notification priority doesn't have any effect.

if(Build.VERSION.SDK_INT >= 26) {
    NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID,
            CHANNEL_NAME, NotificationManager.IMPORTANCE_LOW);
    mNotificationManager.createNotificationChannel(notificationChannel);
    notification = new Notification.Builder(this,CHANNEL_ID)
            .setContentTitle("My App")
            .setContentText(status)
            .setSmallIcon(R.drawable.ic_stat_notify)
            .setContentIntent(pendingIntent)
            .build();
}

I have checked IMPORTANCE_MIN, IMPORTANCE_DEFAULT and IMPORTANCE_LOW, all are making sound

1

There are 1 best solutions below

0
On BEST ANSWER

Once the notification channel has been created, it's not possible to change the importance anymore.

You need to clear the app data or uninstall the app in order to remove the channel and create it again with a different importance level.