【问题标题】:Two notifications with same ID but diffrent Noification channels两个具有相同 ID 但通知渠道不同的通知
【发布时间】:2019-08-06 08:02:04
【问题描述】:

我正在使用两个不同的应用从我的应用生成两个本地通知 通知渠道。通知配置如下,

1.) Notification1 (notification_channel: msg_1 and notification_id: 1)

2.) Notification2 (notification_channel: msg_2 and notification_id: 1)

在这种情况下会发生什么?

它将显示单个通知 它将显示两个单独的通知

我想知道你的预期行为?

【问题讨论】:

  • 这种情况会发生什么?自己试试看
  • 将显示两个通知

标签: android notifications notification-channel


【解决方案1】:

我已经探索了该场景,它将显示为不同的通知,因为操作系统使用 notificationId 在托盘上的通知堆栈中单独显示通知。如果您传递相同的 notificationId ,操作系统只会将旧通知与新通知重叠。

此外,通知通道配置仅应用于 notificationId 以显示特定行为。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-10
    • 1970-01-01
    • 2021-02-17
    • 2021-05-05
    • 2017-09-12
    相关资源
    最近更新 更多