Is there any reason to continue using IntentService for handling GCM messages?

后端 未结 1 1830
失恋的感觉
失恋的感觉 2020-12-19 08:51

As you know, recently Google changed their GCM documentation, and they claim that an IntentService is no longer required for handling arriving GCM messages. All

相关标签:
1条回答
  • 2020-12-19 09:35

    Why would most apps use an IntentService?

    Because most likely whatever you are doing in response to the message will take more than 1-2ms, which means that you want to get that work off the main application thread. A common pattern for doing that in response to a broadcast is to delegate the work to an IntentService.

    So, if your work in response to the GCM message involves:

    • disk I/O
    • further network I/O (e.g., retrieving additional data from your Web service)
    • substantial calculations (e.g., image processing)

    you will likely want to use an IntentService to perform that work.

    0 讨论(0)
提交回复
热议问题