If you changed the package, they are different interfaces, and you can't
call across them.  This is exactly what the error message is saying, you can
see the two different interfaces listed there.  You should define the
interface once and share it across all of the code using it.

On Wed, Jan 14, 2009 at 10:22 AM, rktb <yend...@pv.com> wrote:

>
> Hi,
>
> I tried to follow what was being discussed in
> http://code.google.com/android/reference/aidl.html#calling and
>
> http://code.google.com/android/samples/ApiDemos/src/com/example/android/apis/app/
> .
> My test code looks almost the same. The only difference being that in
> my case, the service and the activity that is calling it, are both in
> different packages.
>
> To get around the compilation errors, I included the same .aidl file
> (IRKOwnService.aidl) defining the interface in both the packages (with
> the package line different in both the files). I think that is what is
> causing the problem.
>
> Any suggestions?
>
> Thanks,
> Ravi
>
> On Jan 14, 1:34 am, "Dianne Hackborn" <hack...@android.com> wrote:
> > You are calling on an interface that is different than the actually
> > interface being called on the back-end service.
> >
> > The remote service API demo should show you how to do this correctly.
> >
> >
> >
> > On Tue, Jan 13, 2009 at 10:20 AM, rktb <yend...@pv.com> wrote:
> >
> > > Bumping it up ...
> >
> > > On Jan 13, 12:39 pm, rktb <yend...@pv.com> wrote:
> > > > Hi,
> >
> > > > I could not find "Reply" on the post:
> > >http://groups.google.com/group/android-developers/browse_thread/threa..
> ..
> > > > So, creating a new post.
> >
> > > > Based on Dianne's example, I am able to start a remote service and
> > > > also call "bindService". Now, when I am trying to call a method, I am
> > > > seeing the following problem:
> > > > ~~~~~~~~~~
> > > > W/Parcel  (  319): **** enforceInterface() expected
> > > > 'com.android.rkserv.IRKOwnService' but read
> > > > 'com.android.rkapp.IRKOwnService'
> > > > D/AndroidRuntime(  342): Shutting down VM
> > > > W/dalvikvm(  342): threadid=3: thread exiting with uncaught exception
> > > > (group=0x4000fe68)
> > > > E/AndroidRuntime(  342): Uncaught handler: thread main exiting due to
> > > > uncaught exception
> > > > E/AndroidRuntime(  342): java.lang.SecurityException: Binder
> > > > invocation to an incorrect interface
> > > > ~~~~~~~~~~
> >
> > > > The following are the details of my packages:
> >
> > > > Package "com.android.rkserv" consists of a service RKOwnService. It
> > > > has the IDL file IRKOwnService.aidl. The AndroidManifest.xml consists
> > > > of the service
> > > > <service android:name=".RKOwnService" android:exported="true"
> > > > android:process=":remote" >
> > > >     <intent-filter>
> > > >         <action android:name="com.android.RKINTENT" />
> > > >     </intent-filter>
> > > > </service>
> >
> > > > Package "com.android.rkapp" wants to access this service.
> > > > The service is started via
> > > >     Intent serv = new Intent();
> > > >     serv.setAction("com.android.RKINTENT");
> > > >     startService(serv);
> >
> > > > The service is bound via
> > > >     bindService(new Intent("com.android.RKINTENT"),rkconn,
> > > > Context.BIND_AUTO_CREATE);
> >
> > > > The service is stopped via
> > > >     Intent serv = new Intent();
> > > >     serv.setAction("com.android.RKINTENT");
> > > >     stopService(serv);
> >
> > > > All the above actions go through fine. Next, I try to call a function
> > > > defined in the interface as
> > > >     private final IRKOwnService.Stub mBinder = new IRKOwnService.Stub
> > > > () {
> > > >         public void callFn1() {
> > > >             RKOwnService.this.callFn1();
> > > >         }
> > > >     };
> > > > This is when I see the error --
> > > > W/Parcel  (  319): **** enforceInterface() expected
> > > > 'com.android.rkserv.IRKOwnService' but read
> > > > 'com.android.rkapp.IRKOwnService'
> >
> > > > NOTE: To get rid of compilation errors, I added "IRKOwnService.aidl"
> > > > in the calling package "com.android.rkapp".
> >
> > > > Any pointers would be appreciated.
> >
> > > > Thanks,
> > > > Ravi
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support.  All such questions should be posted on public
> > forums, where I and others can see and answer them.
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to