我想为Android Oreo 创建一个通知 channel ,其中默认声音 是静音,我试图不指定声音并且在发送通知时它仍然会播放声音。有什么想法吗?
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);
最佳答案
在创建 channel 时添加chan2.setSound(null, null);
。
关于Android Notification Channel默认无声铃声,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46254038/