![](/img/trans.png)
[英]How to handle Firebase push notification when iOS app is suspended/killed and user clicks on the notification?
[英]How to open a link when user clicks on Firebase notification in a Flutter App?
我在 Flutter 應用程序中使用 Firebase。 要發送通知,我使用的是Firebase 消息插件。 每當我使用 Firebase 網站發送通知時,通知只會在用戶單擊時打開應用程序。 我想發送一個打開 URL 而不是應用程序的通知。
我不知道這些信息是否有用:在 Firestore 上撰寫通知時,我總是將click_action
為FLUTTER_NOTIFICATION_CLICK
在 Additional Options 的“Custom data”部分。
您可以使用 onLaunch() 和 onResume() 方法來處理通知的打開操作。
有關不同平台上通知反應的更多信息,請參見以下鏈接: https://pub.dev/packages/firebase_messaging#receiving-messages
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print("onMessage: $message");
},
onBackgroundMessage: myBackgroundMessageHandler,
onLaunch: (Map<String, dynamic> message) async {
print("onLaunch: $message");
},
onResume: (Map<String, dynamic> message) async {
print("onResume: $message");
},
);
您可以使用 url_launcher 打開 URL: https://pub.dev/packages/url_launcher
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.