TrillBit SDK
  • Introduction
  • technological overview
    • In this release
    • Use cases
    • Quick links
  • features
    • Payloads and Datarates
    • Protocols
    • Configurations
    • Distances
    • Platforms supported
  • demo applications
    • TrillPlay
      • Specifications
    • TrillIoT
    • Knowles SmartMic
  • Knowles smartmic support
    • Trill SDK for Knowles
      • Requirements
      • Setup Guide
        • Licensing and Setting up Trillbit Host library
        • Authentication of the Trillbit IA61x algorithm
        • Sending Data to the SmartMic
      • Trillbit SDK Methods
      • Troubleshooting
  • android support
    • Trill SDK for Android
      • SDK Requirements
      • Setup Guide
        • Licensing credentials
        • Getting started
        • Integrating the SDK
          • Declare your app's audio permissions
          • Import SDK
          • Declare Trill SDK Callback
          • License and Initialise your Trill SDK
      • Methods and Callbacks
        • Sender methods
        • Receiver methods
        • Callbacks
      • Reducing application size
      • Troubleshooting
        • Error codes
  • ios support
    • Trill SDK for iOS
      • SDK Requirements
      • Setup Guide
        • Licensing Trill SDK
        • Getting started
      • Methods and Callbacks
        • Trill SDK Methods
        • Trill SDK Callbacks and delegates
      • Troubleshooting
  • esp 32 support
    • Trill SDK for ESP-32
      • Requirements
      • Platforms supported
      • Setup Guide
        • Licensing and Setting up Trillbit library
        • Sending data to the ESP32 device
      • Methods and Callbacks
      • Troubleshooting
  • embedded linux
    • Trill SDK for Embedded linux
      • Requirements
      • Architectures supported
      • Demo applications
      • Setup Guide
        • Licensing your Trill SDK
        • Compiling example binaries
        • Instantiate Trill SDK
        • Run the demo code
      • Methods and Callbacks
        • Trill SDK Methods
        • Callbacks
      • Troubleshooting
  • Reference
    • References
    • FAQs
Powered by GitBook
On this page
  1. android support
  2. Trill SDK for Android
  3. Setup Guide
  4. Integrating the SDK

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.

PreviousImport SDKNextLicense and Initialise your Trill SDK

Last updated 2 years ago