Does the intent set the queue while calling startService for the IntentService?

I want to download from the Internet using IntentService . I pass the URL through Intent to the IntentService by calling startService(intentserive); .

If I call startService for different purposes, do I start the start queue for the download?

+7
android android-intentservice
source share
2 answers

The short answer to your question is YES. From the docs:

IntentService is the base class for services that process asynchronous requests (expressed as intentions) on demand. Clients send requests through startService (Intent) calls; the service starts as needed, processes each intention, in turn, using the workflow and stops when it ends.

This work queue pattern is typically used to offload tasks from the main application thread. The IntentService class exists to simplify this scheme and take care of the mechanics. To use it, extend the IntentService and implement onHandleIntent (Intent). IntentService will receive Intents, start the workflow, and stop servicing as needed.

All requests are processed on one workflow - they can be accepted as needed (and will not block the main application cycle), but only one request will be processed at a time.

Official link to documents

+11
source share

Yes. The Intent service queues all work intentions and processes them one by one in the same workflow.

0
source share

All Articles