【问题标题】:Android Notification Channel silent ringtone by defaultAndroid 通知频道默认静音铃声
【发布时间】:2017-09-16 12:42:58
【问题描述】:

我想为 Android Oreo 创建一个通知通道,其中 默认声音silent,我尝试不指定声音并且在发送通知时它仍然会播放声音。有什么想法吗?

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);

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

    • 在某些设备中,我的应用强制关闭此解决方案.. 不推荐
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-09
    • 2018-05-24
    • 2019-03-27
    • 1970-01-01
    • 2014-01-20
    相关资源
    最近更新 更多