Multiple IntentService or one Service

后端 未结 3 399
醉话见心
醉话见心 2021-01-31 10:36

I\'m a little confused on the difference between IntentService and Service. I understand that IntentService has a worker queue, but is there any benefit to using multiple Intent

3条回答
  •  清歌不尽
    2021-01-31 11:35

    Its my understanding that the difference between intentService and Service is that an intentService will spawn a worker thread to run it, while a Service runs in the main thread of it's hosting process. In addition, an intentService will stop itself when the work is done, while a Service will continue running until stopSelf, or stopService is called.

    If the 3 data sources need to share information with each other, then put them all in the same Service, otherwise keep them separate because if one data source is down it will leave a fat service running instead of just a single light Service.

提交回复
热议问题