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

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

        <legend id='AMlnw'><style id='AMlnw'><dir id='AMlnw'><q id='AMlnw'></q></dir></style></legend>
      1. FirebaseInstanceId.getInstance().getToken() = null 什么时候?

        时间:2023-07-28
          <tbody id='8h0CT'></tbody>
        <i id='8h0CT'><tr id='8h0CT'><dt id='8h0CT'><q id='8h0CT'><span id='8h0CT'><b id='8h0CT'><form id='8h0CT'><ins id='8h0CT'></ins><ul id='8h0CT'></ul><sub id='8h0CT'></sub></form><legend id='8h0CT'></legend><bdo id='8h0CT'><pre id='8h0CT'><center id='8h0CT'></center></pre></bdo></b><th id='8h0CT'></th></span></q></dt></tr></i><div id='8h0CT'><tfoot id='8h0CT'></tfoot><dl id='8h0CT'><fieldset id='8h0CT'></fieldset></dl></div>
        <legend id='8h0CT'><style id='8h0CT'><dir id='8h0CT'><q id='8h0CT'></q></dir></style></legend>

        • <bdo id='8h0CT'></bdo><ul id='8h0CT'></ul>

            1. <small id='8h0CT'></small><noframes id='8h0CT'>

                  <tfoot id='8h0CT'></tfoot>

                  本文介绍了FirebaseInstanceId.getInstance().getToken() = null 什么时候?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  从何处、何时检索令牌以及何时可用?

                  From where and when is the token retrieved and when is it available?

                  它是对 Firebase 服务器的同步调用吗?如果我在应用生命周期中过早调用它,它可能还没有被填充吗?

                  Is it a synchronous call to the Firebase server? If I call it too soon in the app lifecycle, might it not have been populated yet?

                  推荐答案

                  从何时何地检索令牌以及何时可用?

                  令牌由 FCM Instance ID 服务在后台生成,该服务会在您的应用运行后立即启动.关于如何生成令牌的详细信息尚不清楚,但我认为设备需要与互联网建立良好的连接才能与令牌的 FCM 服务器进行通信.

                  The token is generated by the FCM Instance ID service in the background, which starts as soon as your app runs. The details on how the token gets generated is unclear, but how I see it is that the device needs a decent connection to the internet in order for it to communicate with the FCM servers for the token.

                  是对 Firebase 服务器的同步调用吗?

                  从技术上讲,没有.如 docs 中所述:

                  Technically speaking, no. As mentioned in the docs:

                  FirebaseInstanceID.getToken() 如果尚未生成令牌,则返回 null.

                  FirebaseInstanceID.getToken() returns null if the token has not yet been generated.

                  此时,如果令牌为空,您应该期望在您的 onNewToken() 中有一个触发器,然后您可以在其中调用 getToken(),它现在应该包含令牌.

                  At this time, if the token is null, you should expect a trigger in your onNewToken() where you could then call getToken() which should now contain the token.

                  如果我在应用生命周期中过早调用它,它可能还没有被填充吗?

                  通常可以尽快调用 getToken() - 在您应用的 MainActivity 中 - 在大多数情况下,当您的应用到达该点时,它已经有了一个值.但是话又说回来,如果它为null,您仍然应该正确处理它.

                  It's usually okay to call getToken() as soon as possible -- in your app's MainActivity -- in most cases, by the time your app reaches that point, it already has a value. But then again, you should still handle it properly if it is null.

                  这篇关于FirebaseInstanceId.getInstance().getToken() = null 什么时候?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:UIButton 标题文本颜色 下一篇:当设备屏幕关闭时,如何处理 Firebase 通知?

                  相关文章

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

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