首页 > 解决方案 > 颤动本地通知:频道ID是什么?

问题描述

我正在使用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 中我们需要为其提供 a id、 aname和 a description

标签: androiddartflutter

解决方案


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

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


推荐阅读