views:

71

answers:

1

Hi im trying to use Remote Service btween two simple application, But its not easy to me. So any advice you have will help me.

here`s my case.

I made one app which is playing Music in service, There are two components. one is Activity controlling service by using three buttons, play,pause, stop. and it is working fine.

and another one is just simple Activity which also has four buttons bind,play,stop,unbind. when i click bind, it`s confirmed by Toast msg, but when i click play button,it occurs error.

i want to control first activitys Music playing service in second Activity. So im trying to use remote service. i made same .aidl file in each app project. In aidl file, i defined methods "playing","stoping" and i implement those methods in Music service class, implementation is simply use intent and startService & stopService.

In DDMS there is "java.lang.SecurityException : Binder invocation to an incorrect interface" thats the case what im doing.

So please tell me what`s the problem. any advice could help me. thanks Gun.

A: 

First, get rid of the AIDL. You do not need a remote service for a music player application. AIDL and remote services are for communication between applications, not for within a single application.

Here is a sample project showing local binding to a service, without AIDL, if it helps you determine how best to use the binding pattern.

CommonsWare