Actually I use a local service without aidl, I allocate a dummy binder (new Binder()) in onBind(). This service manages an XMPP connection, even if no screen is shown to user (there is an ongoing notification with a life cycle corresponding to the service's one, and so I guess my use of Service.setForeground(true) is valid) and the activity uses a singleton instance to interact with it. To stop the service, the notification shows the main activity which has a "sign out" menu, the actual unbind&stopService is made on activity's onDestroy() if the user has signed out, this will dismiss the notification as well.
2009/7/19 Mark Murphy <[email protected]> > > Dianne Hackborn wrote: > > Ultimately calls through a binder object are a direct function call. > > Most of my comments along these lines have been about defining aidl > > interfaces for communicating with local services, which is a waste > > (there is lots of generated code that will never be used), and a lot > > more work (you need to define your interface solely in terms of what > > aidl supports). > > > > The local service api demo shows a good way to go about this: > > > > > http://android.git.kernel.org/?p=platform/development.git;a=blob;f=samples/ApiDemos/src/com/example/android/apis/app/LocalServiceBinding.java;h=ddcfad5fc3fcf2b4f2c3630e75cff2cba7f95ad7;hb=HEAD > > Good to know -- thanks! > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Need Android talent? Ask on HADO! http://wiki.andmob.org/hado > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

