简体   繁体   English

Flutter FCM推送通知-前台通知点击事件

[英]Flutter FCM push notification - Foreground Notification tap event

Am using firebase_messaging and flutter_local_notifications packages, Currently am able to get the notification data when the user tap the notification when the app is in the background.我正在使用firebase_messagingflutter_local_notifications包,目前当用户在应用程序处于后台时点击通知时能够获取通知数据。 How can i listen to the tap event when the app is in the foreground.当应用程序在前台时,我如何收听点击事件。

You can try this, hope its help you:你可以试试这个,希望对你有帮助:

FirebaseMessaging.onMessage.listen((RemoteMessage message) {
  print('Got a message whilst in the foreground!');
  print('Message data: ${message.data}');

  if (message.notification != null) {
    print('Message also contained a notification: ${message.notification}');
  }
});

I copy that code from the Flutter Fire documentation, I will put the link here https://firebase.flutter.dev/docs/messaging/usage我从 Flutter Fire 文档中复制该代码,我将把链接放在这里https://firebase.flutter.dev/docs/messaging/usage

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter iOS 应用程序在前台时的 FCM 推送通知 - Flutter FCM push notification for iOS when app is in foreground Flutter FCM 推送通知在用户点击通知时显示空白屏幕 state - Flutter FCM push notification show the blank screen when user tap on Notification in killed state Flutter FCM 推送通知在后台收到两个通知 - Flutter FCM Push Notification getting two notification in background FCM - Flutter 点击通知打开应用程序(所有州) - FCM - Flutter tap on notification to open app (all states) FCM 推送通知 - 图片不推送 - FCM push notification - image not push 可以在特定时间使用 FCM IN FLUTTER 发送推送通知 - It is Possible to send Push notification at specific time Using FCM IN FLUTTER 这是否可以通过后端服务器将 FCM 推送通知发送到 flutter 以安排通知,或者这可以在 flutter 应用程序中实现 - Is this possible to send FCM push Notification through backend server to flutter for scheduled the notification or this can be possible in flutter app Flutter Firebase 前台推送通知未显示,但后台正在工作 - Flutter Firebase foreground push notification not showing but background is working FCM 通知在前台和后台收到两次 - FCM Notification Receive Twice in Foreground and Background FCM前台和后台通知布局视图和PendingIntent - FCM Foreground and Background notification layout view and PendingIntent
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM