1. <small id='odlK1'></small><noframes id='odlK1'>

      <tfoot id='odlK1'></tfoot>
      • <bdo id='odlK1'></bdo><ul id='odlK1'></ul>

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

        <legend id='odlK1'><style id='odlK1'><dir id='odlK1'><q id='odlK1'></q></dir></style></legend>

      1. 当设备屏幕关闭时,如何处理 Firebase 通知?

        时间:2023-07-28
        1. <small id='V44IX'></small><noframes id='V44IX'>

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

                <bdo id='V44IX'></bdo><ul id='V44IX'></ul>

                  <tbody id='V44IX'></tbody>

                  <tfoot id='V44IX'></tfoot>
                1. <legend id='V44IX'><style id='V44IX'><dir id='V44IX'><q id='V44IX'></q></dir></style></legend>
                2. 本文介绍了当设备屏幕关闭时,如何处理 Firebase 通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我将尝试在设备屏幕关闭时处理 Firebase 通知,这意味着在通知到达时唤醒设备.在我的项目通知中,可以分为这样的状态,以便我可以在需要时以编程方式唤醒设备.也可以使用唤醒锁,但实际上是在屏幕关闭时

                  I will try to handle firebase notification when device screen off means wake up the device when a notification arrives. In my project notification divide into so may state so how I can wake up device programmatically whenever required. May also use wake lock, but when screen off then actually

                      @Override
                      public void onMessageReceived(RemoteMessage message) {
                      }
                  

                  在这种情况下没有调用此方法,那么我该如何唤醒设备?有哪位朋友可以帮我解决这个问题吗?

                  This method not called so in this circumstances so how I can wake up the device? Can any buddy help me with this issue?

                  推荐答案

                  FCM(Firebase Cloud Messaging)中有两种类型的消息:

                  通知消息:这些消息仅在您的应用处于前台时触发 onMessageReceived() 回调

                  Notification Messages: These messages trigger the onMessageReceived() callback only when your app is in foreground

                  数据消息:这些消息会触发 onMessageReceived() 回调,即使您的应用处于 foreground/background/killed

                  Data Messages: Theses messages trigger the onMessageReceived() callback even if your app is in foreground/background/killed

                  注意:确保您没有添加 JSON 密钥通知

                  NOTE: Be sure you're not adding JSON key notification

                  当您的应用在后台或被杀死时,以下消息不会调用您的 onMessageReceived(),并且您无法自定义通知.

                  The following message will not call your onMessageReceived() when your app is in the background or killed, and you can't customize your notification.

                  {
                        "to": "example",
                        "notification": {
                          "title" : "title",
                          "text": "text"
                         }
                      }
                  

                  但是使用它会起作用

                  {
                         "to": "example",
                         "data": {
                             "text":"text",
                             "title":"title"
                         }
                      } 
                  

                  这篇关于当设备屏幕关闭时,如何处理 Firebase 通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:FirebaseInstanceId.getInstance().getToken() = null 什么时候? 下一篇:Google-services.json:“api_key"部分中有什么内容可以启用 Firebase 推送通

                  相关文章

                3. <small id='Vvhfk'></small><noframes id='Vvhfk'>

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

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

                      <bdo id='Vvhfk'></bdo><ul id='Vvhfk'></ul>