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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en