扑朔迷离的本地通知:什么是频道ID?

时间:2018-12-16 15:18:53

标签: android dart flutter

我正在使用flutter_local_notifications,并创建通知(我们将重点放在android上),请执行以下操作:

var androidPlatformChannelSpecifics =
        new AndroidNotificationDetails(
          'your other channel id',
          'your other channel name', 
          'your other channel description');
    var iOSPlatformChannelSpecifics =
        new IOSNotificationDetails();
    NotificationDetails platformChannelSpecifics = new NotificationDetails(
        androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);

您可以在android案例中看到,您提供了3个与频道相关的参数
所以我的问题是此通道的用途,为什么在android中我们需要为其提供idnamedescription

1 个答案:

答案 0 :(得分:1)

通知渠道使我们能够对通知进行分组,并让用户与这些渠道进行互动。

假设您正在构建聊天应用程序,可以将来自 Alice 的消息分组到 channel-alice 通道下,并且只能将 channel-alice静音或对其执行不同的操作。 API级别26之后需要通道。