有没有办法在应用程序被杀死时接收数据通知? [英] Is there a way to receive data notifications in flutter when the app is killed?

查看:40
本文介绍了有没有办法在应用程序被杀死时接收数据通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 android 中的推送通知实现自定义 ui(标题、正文、从 url 加载的图像),

I am trying to implement custom ui for push notifications in android (title, body, image loaded from url),

firebase_messaging dart 插件在应用被终止时接收数据通知有限制.

the firebase_messaging dart plugin has a limitation for receiving data notifications when the app is killed.

使用数据有效负载而不是通知有效负载是在 android 本机中绘制自定义 ui 通知的选项.

using data payload instead of notifications payload is the option to draw custom ui notifications in android natively.

有没有办法在应用被杀死时接收数据通知?

Is there a way to receive data notifications in flutter when the app is killed ?

推荐答案

你可以在headless函数中编写一个后台消息处理程序,并使用firebase本地通知插件来显示通知

You can write a background message handler in headless function and use firebase local notification plugin to show the notification

本教程一定会对你有所帮助
https://medium.com/@sylvainduch/firebase-messaging-抓住他们所有-3f9c594734d7

this tutorial will definitely help you
https://medium.com/@sylvainduch/firebase-messaging-catch-them-all-3f9c594734d7

这篇关于有没有办法在应用程序被杀死时接收数据通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆