如何在Android Q上显示扩展的静默通知

问题描述 投票:0回答:1

我试图实现的是类似#2的通知(“已连接USB调试”):以标题和说明显示在单独的行上。

但是,当我创建一个通知渠道时,NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_MIN)将显示为通知#3-折叠标题并在同一行上-不管通知本身的优先级如何[priority = NotificationCompat.PRIORITY_MINpriority = NotificationCompat.PRIORITY_HIGH

如果渠道重要性增加到LOWNotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_LOW)或更高级别的通知显示为正常通知#1(“正在运行同步”)

如何显示展开的静默通知?我也尝试设置其他选项,例如setSound(null, null)等,但它们也不起作用。

enter image description here

android notifications notification-channel silent-notification
1个回答
0
投票
NotificationCompat.Builder builder; .... if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) builder.setStyle(new NotificationCompat.BigTextStyle());
© www.soinside.com 2019 - 2024. All rights reserved.