[英]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_messaging和flutter_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.