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:

  1. OnSDKReady: This callback is passed once the initialisation process for SDK is completed.

  2. OnDataReceived: This callback is received once the data sent is received on the receiver end.

  3. OnPlayingCompleted: This callback is returned when SDK has completed playing for all repeat count

  4. OnSendingCompleted: this callback is passed on sending process being completed.

There are two callbacks for error and information:

  1. onError: This is a general callback to return error message with code

  2. 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