Is there a limit to the queue size in an IntentService?
android, intentservice
Solution
tl;dr No.
From android source (API 19):
It looks like the `IntentService` just uses a regular `Looper` and `Handler` tied to a thread.
When you call start on the intent service with a new intent, it just sends the intent to the handler as a message.
@Override
public void onStart(Intent intent, int startId) {
Message msg = mServiceHandler.obtainMessage();
msg.arg1 = startId;
msg.obj = intent;
mServiceHandler.sendMessage(msg);
}
The handler:
private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
onHandleIntent((Intent)msg.obj);
stopSelf(msg.arg1);
}
}
The `Looper` that the `Handler` uses has a `MessageQueue` that does not have a maximum number of items that can be added to it.
Problem
I'm not likely to hit any roof that may exist, but it is possible that i might send a lot of intents to an IntentService. I was curious to find out if there is an upper limit to how many Intents you can send to a IntentService? Is there a size limit to the queue? I couldn't find anything in the documentation about this. Thanks in advance