颤振本地通知:频道 ID 是什么?

Sli*_*nTN 5 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);
Run Code Online (Sandbox Code Playgroud)

正如您在 android 案例中看到的,您提供了 3 个与频道相关的参数
所以我的问题是这个频道的用途是什么,为什么在 android 中我们需要为它提供一个id、一个name和一个description

wes*_*tdb 9

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

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

  • 当然,您可以将所有通知放在一个通道中,也可以根据上下文将通知分成多个通道。 (2认同)