4

我已经升级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();
}

我查过了,IMPORTANCE_MIN一切都在发出声音IMPORTANCE_DEFAULTIMPORTANCE_LOW

4

1 回答 1

6

一旦创建了通知通道,就无法再更改重要性。

您需要清除应用程序数据或卸载应用程序才能删除频道并重新创建具有不同重要性级别的频道。

于 2017-11-30T18:08:03.100 回答