<tfoot id='pAiQX'></tfoot>
  1. <legend id='pAiQX'><style id='pAiQX'><dir id='pAiQX'><q id='pAiQX'></q></dir></style></legend>
  2. <small id='pAiQX'></small><noframes id='pAiQX'>

    1. <i id='pAiQX'><tr id='pAiQX'><dt id='pAiQX'><q id='pAiQX'><span id='pAiQX'><b id='pAiQX'><form id='pAiQX'><ins id='pAiQX'></ins><ul id='pAiQX'></ul><sub id='pAiQX'></sub></form><legend id='pAiQX'></legend><bdo id='pAiQX'><pre id='pAiQX'><center id='pAiQX'></center></pre></bdo></b><th id='pAiQX'></th></span></q></dt></tr></i><div id='pAiQX'><tfoot id='pAiQX'></tfoot><dl id='pAiQX'><fieldset id='pAiQX'></fieldset></dl></div>
      • <bdo id='pAiQX'></bdo><ul id='pAiQX'></ul>

      如何在单击推送通知时打开特定屏幕以进行颤动

      时间:2023-07-30
        <tbody id='HG3Yz'></tbody>
        • <bdo id='HG3Yz'></bdo><ul id='HG3Yz'></ul>

              <i id='HG3Yz'><tr id='HG3Yz'><dt id='HG3Yz'><q id='HG3Yz'><span id='HG3Yz'><b id='HG3Yz'><form id='HG3Yz'><ins id='HG3Yz'></ins><ul id='HG3Yz'></ul><sub id='HG3Yz'></sub></form><legend id='HG3Yz'></legend><bdo id='HG3Yz'><pre id='HG3Yz'><center id='HG3Yz'></center></pre></bdo></b><th id='HG3Yz'></th></span></q></dt></tr></i><div id='HG3Yz'><tfoot id='HG3Yz'></tfoot><dl id='HG3Yz'><fieldset id='HG3Yz'></fieldset></dl></div>

              <tfoot id='HG3Yz'></tfoot>
                <legend id='HG3Yz'><style id='HG3Yz'><dir id='HG3Yz'><q id='HG3Yz'></q></dir></style></legend>

                <small id='HG3Yz'></small><noframes id='HG3Yz'>

                本文介绍了如何在单击推送通知时打开特定屏幕以进行颤动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试在单击推送通知时打开特定屏幕,我的有效负载如下所示:

                I am trying to achieve open specific screen on clicking push notification and my payload looks like this:

                 var payload = {
                        notification: {
                            title: notificationTitle,
                            body: notificationMessage,
                            click_action:"/screena",sound:"default",
                        }
                    };
                

                我收到通知,但我无法捕捉通知点击事件,如何捕捉它.我正在使用颤振消息传递

                I am getting notification but I am unable to catch notification click event in flutter how to catch it. I am using flutter messaging

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

                我的 firebase 推送消息服务代码如下所示

                and my firebase push message service code looks like this

                 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 在消息中所说的消息,但我的问题是如何从系统托盘中出现的推送通知中捕获点击事件并导航到所需的屏幕.

                here I can get the message as @xqwzts said in on message when my app is in the foreground but my question is how to catch click event from push notification raised in the system tray and navigate to the required screen.

                推荐答案

                这里有几点:

                1- click_action 必须设置为 FLUTTER_NOTIFICATION_CLICK"

                2- click_action 必须在有效负载的 data 部分中设置

                2- click_action has to be set in the data section of a payload

                DATA='{
                  "notification": {
                    "body": "this is a body",
                    "title": "this is a title",
                  },
                  "data": {
                    "click_action": "FLUTTER_NOTIFICATION_CLICK",
                    "sound": "default", 
                    "status": "done",
                    "screen": "screenA",
                  },
                  "to": "<FCM TOKEN>"
                }'
                

                这应该允许您在 Flutter 应用的 onMessage 处理程序中接收消息.

                This should allow you to receive the message in the onMessage handler in your flutter app.

                您可以从那里调用 Navigator.of(context).pushNamed(message['screen']).

                如果此时您没有 BuildContext,您可以将 GlobalKey 注册为 navigatorKey 属性MaterialApp,并使用它通过 GlobalKey.currentState

                If you don't have a BuildContext at that point, you can register a GlobalKey as the navigatorKey property of your MaterialApp, and use it to access your Navigator globally, via GlobalKey.currentState

                这篇关于如何在单击推送通知时打开特定屏幕以进行颤动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:firebase的app token在什么时期发生变化,如何管理? 下一篇:从android中的firebase发送通知时没有通知声音

                相关文章

                1. <tfoot id='TeQmy'></tfoot>
                  <i id='TeQmy'><tr id='TeQmy'><dt id='TeQmy'><q id='TeQmy'><span id='TeQmy'><b id='TeQmy'><form id='TeQmy'><ins id='TeQmy'></ins><ul id='TeQmy'></ul><sub id='TeQmy'></sub></form><legend id='TeQmy'></legend><bdo id='TeQmy'><pre id='TeQmy'><center id='TeQmy'></center></pre></bdo></b><th id='TeQmy'></th></span></q></dt></tr></i><div id='TeQmy'><tfoot id='TeQmy'></tfoot><dl id='TeQmy'><fieldset id='TeQmy'></fieldset></dl></div>

                      <bdo id='TeQmy'></bdo><ul id='TeQmy'></ul>
                  1. <legend id='TeQmy'><style id='TeQmy'><dir id='TeQmy'><q id='TeQmy'></q></dir></style></legend>

                  2. <small id='TeQmy'></small><noframes id='TeQmy'>