相关疑难解决方法(0)

如何在点击推送通知时打开特定屏幕

我试图在点击推送通知时实现打开特定屏幕,我的有效负载如下所示:

 var payload = {
        notification: {
            title: notificationTitle,
            body: notificationMessage,
            click_action:"/screena",sound:"default",
        }
    };
Run Code Online (Sandbox Code Playgroud)

我收到通知但我无法捕捉到flutter中的通知点击事件如何捕获它.我正在使用扑动消息

https://github.com/flutter/plugins/tree/master/packages/firebase_messaging

和我的firebase推送消息服务代码看起来像这样

 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);
 });
 }
Run Code Online (Sandbox Code Playgroud)

这里我可以得到消息,因为@xqwzts在我的应用程序处于前台时在消息中说,但我的问题是如何从系统托盘中引发的推送通知中捕获点击事件并导航到所需的屏幕.

android ios dart flutter

21
推荐指数
6
解决办法
1万
查看次数

标签 统计

android ×1

dart ×1

flutter ×1

ios ×1