views:

2385

answers:

2

As a newbie to Android development, I'm trying to do the basics and build a media player. It works fine in one activity, but I'm now moving the MediaPlayer stuff to a remote service so it can carry on after the activity is destroy. I've moved the necessary code to the service, left comments in the activity where I'll need to call service methods, implemented my AIDL and it all builds with no errors (Eclipse).

However, I'm totally stumped as to how to call IPC methods. Are there any simple and minimal examples with no fat - just the bare essentials?

As I'm using IPC methods, I don't need to use onStart() at all - right? (I intend to use LoadFile(File path), and then have public void considerDeath() { if (!isPlaying()) { MyService.stopSelf(); } } method called from activity.onDestroy )

/guide/developing/tools/aidl.html has multiple binders, but when I use the mSecondaryConnection portion, I get "MyService.Stub cannot be resolved"

I've tried http://www.anddev.org/remote%5Fservice%5Ftutorial-t8127.html which seems to confuse things by overloading methods.

I can't find anything by Mark Murphy either on the subject :(

+2  A: 

You should check out the ApiDemos. It comes with the Android SDK download, so you should have it already. There's a couple of remote service demos (in particular I bet you're interested in this one). The ApiDemos are very useful exactly because they are basic implementations, too.

Daniel Lew
A: 

minicompact.com/mobiletalk/?p=18 is also just what I was looking for! (Incidently, I did use AIDL for a local service; it works!)

Chris