NotificationChannel总是在Android 8.0中发出声音

sha*_*anu 4 android notification-channel

我升级target build version27需要实施notification channel.我正在启动一个前景service,它会在启动时显示通知.通过通知渠道,它按预期工作,但它总是如此make sound.更改通知priority没有任何效果.

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();
}
Run Code Online (Sandbox Code Playgroud)

我已经检查了IMPORTANCE_MIN,IMPORTANCE_DEFAULT而且IMPORTANCE_LOW都在发声

jma*_*art 6

创建通知通道后,就无法再更改重要性.

您需要清除应用程序数据或卸载应用程序才能删除该频道并使用不同的重要性级别再次创建该频道.