android - Aidl result via callback -
i have written application records audio signal. signal has processed plug-in installed on device. communication between main application , plug-in, use aidl interface.
as new interfaces, wonder if following work plug-in return result main application:
i created interface:
public interface mainappcallback { public void onresult(string result); }
i implement in recording thread:
mainappcallback callback = new mainappcallback() { @override public void onresult(string result) { // add result member variable of recording thread } };
in aidl interface, defined methods plug-in:
/** callback send results main application */ void registercallback(mainappcallback callback); /** code documentation enough */ void unregistercallback();
i want in recording thread:
plugin.registercallback(callback);
is correct way go, or doing wrong here?
that correct. make sure have defined aidl file callback interface too.
here answer here has example of 2 aidl files need have callbacks : android remote service callbacks
there complete sample code here: https://developer.android.com/guide/components/aidl.html
Comments
Post a Comment