我在应用程序后台时遇到了一个问题,当Firebase先处理通知,然后Flutter本地通知在屏幕上显示弹出窗口时,会出现双重通知的情况。 有没有办法让Firebase不显示通知?
附注:删除FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler); 可以使应用程序在后台不处理通知。
附注:删除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包处理?