androidaidl

Android: AIDL parameter receiving null


I got an activity and a service that are binded.

When the onServiceConnected is called in the ServiceConnection, I do the next thing:

mInterfaceObject = IInterface1.Stub.asInterface(arg1);

mInterfaceObject.register(mController);

Where mController is:

private final IInterface2.Stub mController = new IInterface2.Stub() {

Both IInterface1 and IInterface2 are AIDL files.

Now the problem. In the implementation of the register in the service. The parameter will be null.

What am I doing wrong?


Solution

  • Eclipse automatically added the next method

        @Override
        public IBinder asBinder() {
            return null;
        };
    

    This messed up the whole communication. This method shouldn't be overridden.