Tab*_*san 5 push-notification flutter firebase-cloud-messaging flutter-local-notification
当后台 firebase 中的应用程序首先处理通知,然后 flutter 本地通知在屏幕上显示弹出窗口以使 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);
Run Code Online (Sandbox Code Playgroud)
firebaseMessagingBackgroundHandler:
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage? message) async {
_showNotification(
id: 0,
title: message?.notification?.title ?? '',
body: message?.notification?.body ?? '');
}
Run Code Online (Sandbox Code Playgroud)
firebase 包在通知标志中包含标题和正文,即使应用程序在后台工作,以任何方式使通知仅由 flutter_local_notification 包处理
flutter_local_notifications包和android通道_showNotification| 归档时间: |
|
| 查看次数: |
2475 次 |
| 最近记录: |