我想为Android Oreo创建一个通知频道,默认声音为静音,我尝试不指定声音,并且在发送通知时它仍会播放声音。有任何想法吗?

NotificationChannel chan2 = new NotificationChannel(SECONDARY_CHANNEL,
            getString(R.string.noti_channel_second),
NotificationManager.IMPORTANCE_HIGH);
    chan2.setLightColor(Color.BLUE);
    chan2.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
    getManager().createNotificationChannel(chan2);

最佳答案

创建频道时添加chan2.setSound(null, null);

10-06 09:33