If you don't like the idea of having the service call some interface method it was handed, you could have the service broadcast intents for whatever interesting things happen, for which your clients register receivers.
On Tue, May 19, 2009 at 6:54 AM, Rob Pridham <[email protected]> wrote: > > Hi. > > In my ideal little dream world, I'd like to have a custom service > running that handles network comms. Activities (e.g. UIs) then add > listeners to it and it provides callbacks when anything interesting > happens. > > As it stands, I can't see how to do this in an appropriate way. OK, > you can call bindService() and have a ServiceConnection implementation > that monitors the service state. From there you can easily talk *to* > the service whenever you desire, using serialisation over > transactions, but I don't think that helps with communication > initiated by the service. > > The only way I know of doing what I want is by maintaining static > collections of listeners on the service class, which doesn't strike me > as good engineering. > > I suspect I'm missing part of the puzzle - any clues? > > Cheers, > Rob > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

