I was not aware of the overhead issue with a "local" Binder, I thought this
case was optimized.
I hope the Android team will work on this so that we won't have to reinvent
the wheel.
I will look at your code once it'll be available, this sounds interesting.

2009/7/19 Mark Murphy <[email protected]>

>
> Guillaume Perrot wrote:
> > Using both startService and bindService is handy to wait for the
> > onServiceConnected callback before requesting a singleton reference
> > that is set in the service's onCreate.
> > If you do this just after the startService, the reference will be
> > null.
>
> Correct, because startService() (and bindService() FWIW) are asynchronous.
>
> > The startService is needed for the service to continue running when
> > the activities have been destroyed (and call unbind).
>
> Correct.
>
> > A use case is a service managing a background XMPP connection in a
> > chat/social application (only the "sign out" user action would call
> > stopService).
> > So, Mark I don't understand your point when you say not to use both
> > startService and bindService.
>
> Going through Binder, and all of the work to set up an out-of-process
> connection to something in your same process, just to find out when a
> service is ready for use, seems like a waste. I do not get the
> impression that Binder is optimized for the in-process case, given all
> of the comments to that effect from the core Android team.
>
> To that end, I've put together a local IntentBus, that uses Intents and
> IntentFilters to enable decoupled communication between activities and
> services inside of a single process. It works like broadcast Intents,
> just, er, "localcast" instead. If all goes well, an early cut of this
> will go out as open source tomorrow. I haven't focused on this
> particular scenario (activity starting a service and finding out when it
> is ready for use), but it's probably a logical extension of the bus.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> Android 1.5 Programming Books: http://commonsware.com/books.html
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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