I believe that you are expecting the IntentServices to act like
threads.  You will not have multiple instances of an IntentService run
at the same time.  From the documentation at
http://developer.android.com/reference/android/app/IntentService.html:

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.

I admit, the IntentService's documentation isn't very clear.  But in
any case, if you have multiple starts of an IntentService, they will
happen one after the other, and not at the same time.

-Matt

On Nov 4, 1:54 pm, Bret Foreman <[email protected]> wrote:
> I'm trying an experiment where an Activity makes a number of
> consecutive calls to an IntentService. Each call kicks off some
> background work that finishes in a few seconds. So there are multiple
> concurrent instances of the IntentService running. All the instances
> finish at around the same time and each one does a sendBroadcast to
> return a message to the Activity that it's finished. When this
> happens, about 30% of the broadcast intents never get back to the
> Activity's registered receiver.
>
> It looks as if there is some static state inside the IntentService
> class that is in conflict when there are multiple invocations running
> and they are all calling sendBroadcast at about the same time. In
> other words, sendBroadcast appears to be non-re-entrant.
>
> I'd like to package up this example for submission to b.android.com
> but before I do, I'd like to find out a few things from this forum:
>
> 1) Is this a known bug?
> 2) Is this expected behavior (ie not a bug)?
> 3) Has anyone seen anything like this or another case where the
> IntentService worked correctly when used in this way?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to