[英]Flutter FCM push notification - Foreground Notification tap event
我正在使用firebase_messaging和flutter_local_notifications包,目前當用戶在應用程序處於后台時點擊通知時能夠獲取通知數據。 當應用程序在前台時,我如何收聽點擊事件。
你可以試試這個,希望對你有幫助:
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}');
}
});
我從 Flutter Fire 文檔中復制該代碼,我將把鏈接放在這里https://firebase.flutter.dev/docs/messaging/usage
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.