I think it is impossible to know whether a service has finished or not
unless the service itself lets you know that.

If you just check whether the service is still alive - it may be
waiting for a server response - or it may have finished and processing
some other application's requests.

So, I guess you have to request that all services let you know by a
callback when they are done, so that you can continue with the next
service. Probably you also need a timeout, in case a service never
finishes.

Peli

On Feb 3, 8:37 pm, Al Sutton <[email protected]> wrote:
> The services come from different APKs.
>
> Best way to think about it is the main application does some processing
> and an additional number of APKs can contain perform contributions to
> that processing. For example, there may be many APKs each of which has a
> particular stock trading prediction forumla, and a main APK has stock
> price data, the main APK calls each of the strategy APKs with the stock
> history content provider URI and each strategy APK can process the
> history and do what it wants.
>
> The strategy APKs may not come from one place and may be written by many
> different companies (hence why they are seperate APKs)
>
> Hope that clarifies things a bit.
>
> Al.
>
>
>
> Dianne Hackborn wrote:
> > If they are running in the same process, you could just use globals to
> > keep track of who is running and decide what next to do.
>
> > If you really just want one thing to run at a time, though, why not
> > just put it all in one service?  A common pattern is to have a service
> > that you submit work to with startService(), which does each thing
> > given to it in order and stops itself when done.  There is an ApiDemo
> > showing how to structure such a service (the one with three buttons to
> > submit work to it, I can't remember the exact name off-hand).
>
> > On Tue, Feb 3, 2009 at 9:12 AM, Al Sutton <[email protected]
> > <mailto:[email protected]>> wrote:
>
> >     I have an app which will start multiple separate services which
> >     perform
> >     an action and then exit. I don't want them all to run at the same time
> >     (because this may bog down the OS).
>
> >     I have the code for finding the services and starting the
> >     services, but
> >     does anyone know how I can make sure one service has completed before
> >     the next starts.
>
> >     Due to what the app does it will have to start multiple services
> >     and the
> >     actions the services perform have no GUI and may take tens of
> >     seconds or
> >     minutes (hence why I'm using a service so the user isn't just shown a
> >     blank screen every time the next service starts).
>
> >     Anyone have any ideas?
>
> >     Al.
>
> >     --
> >     ======
> >     Funky Android Limited is registered in England & Wales with the
> >     company number  6741909. The registered head office is Kemp House,
> >     152-160 City Road, London,  EC1V 2NX, UK.
>
> >     The views expressed in this email are those of the author and not
> >     necessarily those of Funky Android Limited, it's associates, or it's
> >     subsidiaries.
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected] <mailto:[email protected]>
>
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support.  All such questions should be posted on
> > public forums, where I and others can see and answer them.
>
> --
> ======
> Funky Android Limited is registered in England & Wales with the
> company number  6741909. The registered head office is Kemp House,
> 152-160 City Road, London,  EC1V 2NX, UK.
>
> The views expressed in this email are those of the author and not
> necessarily those of Funky Android Limited, it's associates, or it's
> subsidiaries.
--~--~---------~--~----~------------~-------~--~----~
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