I dunno, I wrote a really awesome service that can do things a more simple solution can not - such as, if it is processing something and the registered callback unregisters, then it finishes processing, I have it queuing the result. The next callback that registers will get that result fired immediately, which is the desired result because this handles the problem of, "What happens if the network process finishes between when activity 1 is destroyed and activity 2 is registered?"
So I got everything working with aidl and binding and my queue and all of that but I have a question about stopping the service. I use startService() to start it and bindService() to bind to it. I'm not sure when I should be stopping it because AFAIK, my activity doesn't know that it's being paused/stopped/destroyed because of a call or because of an orientation change. Also, I'd like to keep the same service running for the life of the application - that is, while any activities are still running in that application. That is the idea of the service, isn't it? Does anyone have suggestions on how I can accomplish that? I'm wondering if I just leave it running, if the OS will eventually kill it because nothing is bound to it and it is inactive. Can I count on that? On May 28, 9:32 am, Mike Hearn <[email protected]> wrote: > You don't need aService, that's way too complicated for what you > need. Especially if you use the RPC stuff (optional but the docs don't > tell you that!) > > If you create the progress dialog using the onCreateDialog() method > then it'll be automatically reconstructed after an orientation > change. > > To receive callbacks as to progress, you can just send to a static > Handler. Create the Handler in your onCreate if it's not already > created, so it's shared between all instances of your activity. Your > thread can then post updates to it. > > When your activity is stopped or paused, you can interrupt() that > thread to tell it to shut down. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

