Declare Trill SDK Callback
Declare TrillSDK Callback to interface with the SDK data. Application can receive and interpret data through Trill SDK callbacks. The Trill SDK will call this function whenever data over sound is received or sending is completed. This callback has to be registered during SDK initialization.
TrillCallbacks Callback = new TrillCallbacks(){
@Override
public void onSDKReady() {
super.onSDKReady();
Log.e("App", "SDK is ready to use");
}
@Override
public void onDataReceived(String payload) {
super.onDataReceived(payload);
Log.e("App", "onDataReceived " + payload);
}
@Override
public void onPlayingCompleted() {
super.onPlayingCompleted();
Log.e("App", "onPlayingCompleted");
}
@Override
public void onSendingCompleted() {
super.onSendingCompleted();
Log.e("App", "onSendingCompleted");
}
@Override
public void onError(int error_code, String error_message) {
super.onError(error_code, error_message);
Log.e("Error", error_message);
}
@Override
public void onInfo(int code, String infoMessage) {
super.onInfo(code, infoMessage);
Log.e("Info", infoMessage);
}
}
There are four data communication callbacks used:
OnSDKReady: This callback is passed once the initialisation process for SDK is completed.
OnDataReceived: This callback is received once the data sent is received on the receiver end.
OnPlayingCompleted: This callback is returned when SDK has completed playing for all repeat count
OnSendingCompleted: this callback is passed on sending process being completed.
There are two callbacks for error and information:
onError: This is a general callback to return error message with code
onInfo: This is a general callback to return information message with code.
For more details on the error and information codes, refer to this page.
Last updated