【发布时间】:2021-02-24 13:33:25
【问题描述】:
我正在使用带有 firebase 的 firebase_messaging 库在颤动中推送通知。文档说 myBackgroundMessageHandler 在应用程序处于后台时被调用。但这并没有发生。
我想在显示通知之前对其标题和正文进行格式化。当应用程序在后台但未调用该特定方法时,我会收到通知。目前它只显示后端在标题和正文中发送的确切文本。 我需要做些什么来启用(?)这个方法吗?我在我的 fcm.configure 方法中有它:
_fcm.configure(
onBackgroundMessage: myBackgroundMessageHandler,
)
static Future<Map<String, dynamic>> myBackgroundMessageHandler(Map<dynamic, dynamic> message) async {
//some code here
return message;
}
提前致谢!
【问题讨论】:
标签: flutter dart push-notification firebase-cloud-messaging