在扑扑的Firebase消息中显示通知徽章

时间:2019-11-25 09:24:22

标签: flutter notifications

问候,我正在使用Firebase消息发送通知到flutter应用程序,它工作正常,但是通知作为状态栏中的应用程序图标接收,并且像任何常规应用程序一样弹出通知栏。这是代码:

 _firebaseMessaging.configure(
  onMessage: (Map<String, dynamic> notification) async {
    setState(() {
      notifications.add(
        Notifications(

          title: notification["notification"]["title"],
          body: notification["notification"]["body"],
          color: Colors.red,
        ),
      );
    });
  },
  onLaunch: (Map<String, dynamic> notification) async {
    setState(() {

      notifications.add(
        Notifications(
          title: notification["notification"]["title"],
          body: notification["notification"]["body"],
          color: Colors.green,
        ),
      );
    });
  },
  onResume: (Map<String, dynamic> notification) async {
    setState(() {
      notifications.add(
        Notifications(
          title: notification["notification"]["title"],
          body: notification["notification"]["body"],
          color: Colors.blue,
        ),
      );
    });
  },
);

这样做是手动设置还是什么?

0 个答案:

没有答案