多次调用 IntentService 的 startService 时 Intent 是否进入队列?

Does intent go queue when calling startService for IntentService multiple times?

我想使用 IntentService 从 Internet 下载。我通过调用 startService(intentserive);.

将 url 通过 Intent 传递给 IntentService

如果我为各种意图调用 startService,这些意图会排队等待下载吗?

您的问题的简短回答是肯定的。来自文档:

IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand. Clients send requests through startService(Intent) calls; the service is started as needed, handles each Intent in turn using a worker thread, and stops itself when it runs out of work.

This "work queue processor" pattern is commonly used to offload tasks from an application's main thread. The IntentService class exists to simplify this pattern and take care of the mechanics. To use it, extend IntentService and implement onHandleIntent(Intent). IntentService will receive the Intents, launch a worker thread, and stop the service as appropriate.

All requests are handled on a single worker thread -- they may take as long as necessary (and will not block the application's main loop), but only one request will be processed at a time.

Official docs link

是的。意图服务将所有工作意图排队,并在单个工作线程中一个一个地处理它们。