当后台firebase中的应用程序首先处理通知然后颤动本地通知在屏幕上显示一个弹出窗口以使firebase不显示通知时,我面临显示双重通知的问题
ps 删除
FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
使应用程序不处理后台通知
FirebaseMessaging.onMessage.listen(
(RemoteMessage? message) async {
_showNotification(
id: 0,
title: message?.notification?.title ?? '',
body: message?.notification?.body ?? '');
},
);
FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
firebaseMessagingBackgroundHandler:
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage? message) async {
_showNotification(
id: 0,
title: message?.notification?.title ?? '',
body: message?.notification?.body ?? '');
}
firebase 包在通知标志中包含标题和正文,即使应用程序在后台工作以任何方式使通知仅由 flutter_local_notification 包处理