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

五迷三道 提交于 2019-11-29 10:24: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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!