开发者

Android bindService / remote services - any basic examples?

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 mu开发者_开发技巧ltiple binders, but when I use the mSecondaryConnection portion, I get "MyService.Stub cannot be resolved"

I've tried http://www.anddev.org/remote_service_tutorial-t8127.html which seems to confuse things by overloading methods.

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜