I have written an application which records some audio signal. This signal has to be processed by a plug-in which is installed on my device. For the communication between the main application and the plug-in, we use an aidl interface.
As I am new to those interfaces, I wonder if the following would work for the plug-in to return a result to my main application:
I created an interface:
public interface MainAppCallback {
public void onResult(String result);
}
I implement it in my recording thread:
MainAppCallback callback = new MainAppCallback() {
@Override
public void onResult(String result) {
// Add result to member variable of recording thread
}
};
In my aidl interface, I defined the methods for the plug-in:
/** Callback to send results to main application
*/
void registerCallback(MainAppCallback callback);
/** The code is documentation enough
*/
void unregisterCallback();
I then want to do something like this in my recording thread:
PlugIn.registerCallback(callback);
Is this the correct way to go, or am I doing something wrong here?