I get the Error message: "Binder invocation to an incorrect interface" on this code:
IBluetoothA2dp ibta = a2dp.connect2.Bt_iadl.ibta2;
try {
if (ibta != null && ibta.getConnectionState(device) == 0)
ibta.connect(device);
else
ibta.disconnect(device);
} catch (Exception e) {
Log.e(LOG_TAG, "Error " + e.getMessage());
}
The error comes on ibta.getConnectionState(device)
That's what I do before:
public static ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mIsBound = true;
ibta2 = IBluetoothA2dp.Stub.asInterface(service);
sendIntent();
}
@Override
public void onServiceDisconnected(ComponentName name) {
mIsBound = false;
}
};
And here is the hierarchy how I set up my packages with the .aidl :
What I'm doing wrong. I read this question: SO-Question . But I didn't know exactly what I'm doing wrong.