Service vs IntentService in the Android platform

后端 未结 11 633
挽巷
挽巷 2020-11-22 03:38

I am seeking an example of something that can be done with an IntentService that cannot be done with a Service (and vice-versa)?

I also bel

11条回答
  •  臣服心动
    2020-11-22 04:11

    The Major Difference between a Service and an IntentService is described as follows:

    Service :

    1.A Service by default, runs on the application's main thread.(here no default worker thread is available).So the user needs to create a separate thread and do the required work in that thread.

    2.Allows Multiple requests at a time.(Multi Threading)

    IntentService :

    1.Now, coming to IntentService, here a default worker thread is available to perform any operation. Note that - You need to implement onHandleIntent() method ,which receives the intent for each start request, where you can do the background work.

    2.But it allows only one request at a time.

提交回复
热议问题