Android Notification Channel默认无声铃声

标签 android android-appcompat android-8.0-oreo notification-channel

我想为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/

相关文章:

android - 无法编译我的android项目

android - oreo 中的文本颜色和元素颜色已更改

android - Oreo 更新后 Android Studio 2.3.3 不再检测到 Pixel 1

android - Gradle 缺少依赖项?

android - 使用 appcompat v21 更改 actionOverflowButtonStyle

android - 在android中设置和获取使用标记 fragment

Android:工具栏 Tablayout,在文本上方呈现的图标

Android 8.0 双重通知音效

java - Retrofit.Callback 的 success() 和 failure() 在同一个 Activity 中有两个接口(interface)实现的情况下

Android加载原生库