Note that you can also use the Messenger class to communicate instead of defining an aidl interface. This is often easier to do -- see the example in the documentation: http://developer.android.com/reference/android/app/Service.html#RemoteMessengerServiceSample
On Wed, Jul 21, 2010 at 10:49 PM, jeffro <[email protected]> wrote: > You're absolutely on the right track. You will define your remote > service and callback using aidl: > > IRemoteService.aidl > IRemoteServiceCallback.aidl > > You will then define a service in another package (APK) that will > return the remote service via onBind to any caller. > > Your calling package will bind to your service: > > final ServiceConnection serviceConnection = this; > Intent remoteGpsServiceIntent = new > Intent("com.trackaroo.apps.mobile.android.OTHER_SERVICE"); > context.bindService(remoteGpsServiceIntent,serviceConnection, > Context.BIND_AUTO_CREATE); > context.startService(remoteGpsServiceIntent); > > your onServiceConnected will that get a reference to your remote > service: > > public void onServiceConnected(ComponentName name, IBinder binder) { > remoteService = IRemoteService.Stub.asInterface(binder); > > and you can pass a callback to the remote service if needed: > > remoteService.registerCallback(this); > > Jeff > > Visit Trackaroo.com! > Trackmaster - Motorsports Lap Timer > Dynomaster - Performance Dyno > > On Jul 20, 4:49 pm, Jonathan <[email protected]> wrote: > > Hello everyone, > > > > I've created a service that is meant to communicated to an activity > > using aidl's and callback functions. I got it working just fine with > > my test activity in the same package. But I was wanting to expose this > > service to different activities running in a completely different .apk > > file. > > > > Is it possible to accomplish this? What does the separate package need > > to bind to my service and register the callbacks? Or am I going about > > this completely wrong and should I try a different method for > > conveying information back and forth between two packages. > > > > Thank-you for reading my post. > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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

