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

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

      <legend id='TUkEs'><style id='TUkEs'><dir id='TUkEs'><q id='TUkEs'></q></dir></style></legend>
    1. <small id='TUkEs'></small><noframes id='TUkEs'>

        FirebaseMessagingService 默认在后台运行吗?

        Does FirebaseMessagingService run in the background by default?(FirebaseMessagingService 默认在后台运行吗?)

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

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

                    <tbody id='DL3eX'></tbody>
                  本文介绍了FirebaseMessagingService 默认在后台运行吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  FirebaseMessagingService 是否像 IntentService 一样在后台运行?

                  Does the FirebaseMessagingService run in the background similar to how an IntentService operates?

                  我看到 FirebaseMessagingService 范围 Service 不在后台运行,但我想确定我是否应该在FirebaseMessagingService 异步或同步.

                  I see that FirebaseMessagingService extents Service which does not run in the background, but I'd like to be sure whether or not I should be doing any work inside the FirebaseMessagingService asynchronously or synchronously.

                  谢谢

                  回答:

                  FirebaseMessagingService 的方法 onMessageReceived(RemoteMessage message) NOT 在主线程上调用 - 所以所有工作都应该同步进行.

                  FirebaseMessagingService's method onMessageReceived(RemoteMessage message) is NOT called on the main thread - so all work should be synchronously.

                  推荐答案

                  FirebaseMessagingService 的方法 onMessageReceived(RemoteMessage message) 被在后台"调用(不在UI/主线程).如果您尝试在 onMessageReceived(RemoteMessage message) 中进行异步工作,您将收到一条错误消息:

                  FirebaseMessagingService's method onMessageReceived(RemoteMessage message) is called "in the background" (not on the UI/Main thread). If you try do asynchronous work inside onMessageReceived(RemoteMessage message) you will receive an error saying:

                  方法execute必须从主线程调用,当前推断线程为worker.

                  Method execute must be called from the main thread, currently inferred thread is worker.

                  所以在 onMessageReceived(RemoteMessage message) 内完成的所有工作都应该同步完成,因为它在自己的后台工作线程中.

                  So all work that is done within onMessageReceived(RemoteMessage message) should be done synchronously because it's in its own background worker thread.

                  这篇关于FirebaseMessagingService 默认在后台运行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  When does a FCM token expire?(FCM 令牌何时到期?)
                  Firebase Cloud Messaging (FCM) - Launch Activity when user clicks the notification with extras(Firebase Cloud Messaging (FCM) - 当用户点击带有附加功能的通知时启动活动)
                  Implement Firebase inside of a Library(在库中实现 Firebase)
                  Firebase Backward compatibility with GCM(Firebase 与 GCM 的向后兼容性)
                  Receiving the FCM notifications multiple times on Nougat(在 Nougat 上多次接收 FCM 通知)
                  Push Notifications are delivered but didReceiveRemoteNotification is never called Swift(推送通知已交付,但 didReceiveRemoteNotification 从未被称为 Swift)
                  • <bdo id='8l92D'></bdo><ul id='8l92D'></ul>
                      <tbody id='8l92D'></tbody>
                    <legend id='8l92D'><style id='8l92D'><dir id='8l92D'><q id='8l92D'></q></dir></style></legend>

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

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

                          • <tfoot id='8l92D'></tfoot>