我试图实现打开特定的屏幕上点击推送通知,我的有效载荷看起来像这样:
var payload = {
notification: {
title: notificationTitle,
body: notificationMessage,
click_action:"/screena",sound:"default",
}
};
我得到通知,但我无法赶上通知点击事件在扑腾如何赶上它。我正在使用颤振信息
Https://github.com/flutter/plugins/tree/master/packages/firebase_messaging
我的消防推送信息服务代码是这样的
pushMessagingService() async{
messagingreference.configure(
onMessage: (Map<String, dynamic> message) {
print("I am here in on message");
print(message);
},
onLaunch: (Map<String, dynamic> message) {
print("I am here onLaunch");
print(message);
},
onResume: (Map<String, dynamic> message) {
print("I am hereonResume");
print(message);
},
);
messagingreference.requestNotificationPermissions(
const IosNotificationSettings(sound: true, badge: true, alert: true));
messagingreference.onIosSettingsRegistered
.listen((IosNotificationSettings settings) {
print("Settings registered: $settings");
});
messagingreference.getToken().then((String token) async {
print(token);
});
}
在这里,当我的应用程序在前台时,我可以得到@xqwzts 在消息中说的消息,但我的问题是如何从系统托盘中提出的推送通知捕捉到点击事件,并导航到所需的屏幕。