Question

I'd like to declare an asynchronous service API in AIDL using ResultReceiver instead of creating my own callback interface.

But when I try to import android.os.ResultReceiver, it doesn't know that ResultReceiver is parcelable. Is there a trick?

Example:

import android.os.ResultReceiver;

interface IPrimeService {
    int computePrimes(in int number, in ResultReceiver resultReceiver);
}

Results in (Android 2.2):

IPrimeService.aidl:3: couldn't find import for class android.os.ResultReceiver

It seems if I create ResultReceiver.aidl in src/android/os within my project like:

package android.os;

parcelable ResultReceiver;

it works, but that seems like such a hack. Is there a better way?

Thanks, Eric

Was it helpful?

Solution

I ran into a similar issue.. I edited /platform/android-<#>/framework.aidl to include the line

parceable android.os.ResultReceiver;

and then it works

credit: http://amdroid.ampache.org/?p=38

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top