I agree. If you are starting the service by binding to it with the activity, once the activity goes away the "bind" will go away and the OS will think there is no reason to keep the service up.
If the service was started using a pending intent from the activity, the service then is started by the underlying OS and should be allowed to continue while it is downloading. Using stopSelf() at that point is the right way to finish things up. Handlers are good for doing shortterm things in the future, but they are still locally instantiated classes, so if the parent class, I.e. an activity or service, dies or is GC'd, the handler goes away as well, and any posted tasks that are waiting inside that handler will not be executed. To ensure a task is executed regardless, AlarmManager is the way to go as Mark mentioned. AlarmManager is not locally instantiated, but instead is an OS service that is always "alive". On Oct 24, 6:34 pm, Dianne Hackborn <hack...@android.com> wrote: > For that kind of thing there should be no need to use bindService at all -- > just call startService() for each of the things to download, and have the > service use stopSelf(id) so that it is stopped once the last one is done. > And there is no reason to delay stopping the service -- starting a service > is quite cheap. > > On Sat, Oct 24, 2009 at 2:08 PM, Christine <christine.kar...@gmail.com>wrote: > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---