gpt4 book ai didi

android - NotificationChannel 在 Android 8.0 中始终发出声音

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:34:11 25 4
gpt4 key购买 nike

我已将目标构建版本升级到27,因此需要实现通知 channel 。我正在启动一个前台 service,它将在启动时显示通知。通过通知 channel ,它按预期工作,但它总是发出声音。更改通知 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_MINIMPORTANCE_DEFAULTIMPORTANCE_LOW,都在发出声音

最佳答案

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

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

关于android - NotificationChannel 在 Android 8.0 中始终发出声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47525851/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com