I’m trying to create a remote service in Eclipse using Android AIDL. I have created my AIDL file IRemoteService.aidl in /src as follows:
package com.vtrandal.bluesentry;
interface IRemoteService {
String getData();
}
After doing a build I get an enormous file IRemoteService.java in /gen containing these classes and methods as follows (it doesn’t resemble anything I’ve seen in the documentation):
public interface IRemoteService extends android.os.IInterface
public static abstract class Stub extends android.os.Binder implements com.vtrandal.bluesentry.IRemoteService
private static final java.lang.String DESCRIPTOR = "com.vtrandal.bluesentry.IRemoteService";
public Stub()
public static com.vtrandal.bluesentry.IRemoteService asInterface(android.os.IBinder obj)
public android.os.IBinder asBinder()
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
private static class Proxy implements com.vtrandal.bluesentry.IRemoteService
Proxy(android.os.IBinder remote)
public android.os.IBinder asBinder()
public java.lang.String getInterfaceDescriptor()
public java.lang.String getData() throws android.os.RemoteException
public java.lang.String getData() throws android.os.RemoteException;
So why does IRemoteService.java contain so much junk not mentioned in the documentation? How could I possibly know what to do with it all? How could I possibly know what to do with any of it?
This is service stub code. It is needed to actually communicate with client. You didn’t write any code for communicating between client and service yourself,did you? It’s not as simple, after all and it is being generated for you. That’s why so much code.
And documentation usually discusses API for user, not stub internal methods.