首页 > 解决方案 > Flutter 和 Firebase:动态推送通知,例如 Whatsapp

问题描述

我见过的关于通知主题的大多数教程要么通过 Firebase 控制台广播通知,要么创建应用程序内通知,如果应用程序在后台或完全关闭,这些通知将不起作用。

即使应用程序关闭,有没有办法使用 Flutter 和 Firebase 动态弹出通知?诸如 Whatsapp 或 Instagram 通知之类的东西。

我所说的 Whatsapp 等通知的参考图像:https ://www.techidence.com/wp-content/uploads/2020/10/WhatsApp-Nootifications.jpg

标签: firebaseflutter

解决方案


您将无法直接从 Flutter 生成动态通知。由于要执行此操作,该应用程序必须处于活动状态。通常你会从某种后端发送这类通知。Google Cloud Messaging 为此公开了一个 API,它允许您向 Endpoint 发送 POST 请求,而 Google 会处理实际通知的发送。

在“1.发送通知”这一点下查看这篇文章

https://medium.com/@selvaganesh93/firebase-cloud-messaging-important-rest-apis-be79260022b5


推荐阅读