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

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

    1. <legend id='GOCmS'><style id='GOCmS'><dir id='GOCmS'><q id='GOCmS'></q></dir></style></legend>

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

      1. Android Firebase Cloud Messaging(FCM):subscribeToTopic 会自动重试

        时间:2023-07-29
      2. <small id='EABNS'></small><noframes id='EABNS'>

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

              • <tfoot id='EABNS'></tfoot>
                  <tbody id='EABNS'></tbody>

                  本文介绍了Android Firebase Cloud Messaging(FCM):subscribeToTopic 会自动重试吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  要在 android 客户端订阅主题,我们应该调用:

                  To Subscribe to a topic in an android client we should call:

                  FirebaseMessaging.getInstance().subscribeToTopic("news");
                  

                  我想知道如果在执行该指令的那一刻互联网连接不可用会发生什么?

                  I want to know what happens if the internet connection is not available at moment that this instruction is executed?

                  当互联网连接可用时,谷歌服务会自动重试订阅吗?还是我们开发者应该处理这种情况?

                  Will google services automatically retry to do subscription when Internet connection become available or we developer should handle this case?

                  推荐答案

                  更新:

                  subscribeToTopic() 现在返回一个 Task<Void> 所以你可以附加一个 OnCompleteListener() 来检查它是否成功.

                  subscribeToTopic() now returns a Task<Void> so you could attach an OnCompleteListener() to check if it is successful or not.

                  更新:

                  因此,根据@DiegoGiorgini 在您之前帖子中的评论,似乎还有更多要订阅的话题:

                  So it seems there's more to subscribeToTopic, as per @DiegoGiorgini's comment in your previous post:

                  subscribeToTopic 将继续在后台重试,但它与您的应用生命周期相关(尚未与谷歌服务相关).因此,如果您的应用程序被终止,它将停止重试,直到应用程序再次打开.(该操作已存储,以便在再次启动应用程序时恢复)

                  subscribeToTopic will keep retry on background, but it's tied to your app lifecycle (not to google services, yet). So if your app is killed it will stop retrying until the app is open again. (the action is stored so it will be resumed when the app is started again)

                  我之前尝试的方式是在给定时间之后,我将杀死该应用程序并且没有再次将其拉起.

                  The way I was trying out before was after the given period, I will be killing the app and didn't pull it up again.

                  所以我试着检查一下.看起来如果发送订阅请求时设备处于离线状态,它会重试一段时间(20-30秒左右?)然后如果仍然没有连接就会停止.请求可能达到超时错误.但是由于 subscribeToTopic(),您无法通过客户端应用程序确定这一点.如果您愿意,可以发送与此相关的 功能请求.

                  So I've tried checking this out. It seems that if the device is offline when the request for subscription is sent, it will re-try for a period of time (20-30 seconds or so?) then will stop if still not connected. The request probably reached a time-out error. But since there is no return value for subscribeToTopic(), there is no way for you to determine this via your client app. You can send in a Feature Request if you want, pertaining to this.

                  但是,就目前而言,我认为您可以做的一种方法是在您的客户端应用程序中设置一个检查器,如果只有设备在线,您就会发送请求.

                  However, as of the moment, an approach I think that you could do is to have a checker in your client app, where if only the device is online will you send the request.

                  您也可以通过您的应用服务器检查它,正如我在您的上一篇文章中提到的那样.

                  You can also check it via your app server as I've mentioned in your previous post.

                  这篇关于Android Firebase Cloud Messaging(FCM):subscribeToTopic 会自动重试吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:未处理的异常:NoSuchMethodError:方法 'toRawHandle' 在 null 上被调 下一篇:确定是否从 FCM 通知单击打开了活动

                  相关文章

                  <tfoot id='D1q7Q'></tfoot>

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

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

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