Android SDK

Download Android SDK


ACRCloudClient is the main class of this SDK. It provides functions of configuration management, automatic audio recording and recognition, manual audio file recognition and so on.


  • This is the construct function of our ACRCloudClient class.
  • You should only have one of this class for one recognition mode ( reqMode ) in your application.


  • You should initilize the ACRCloudClient instance with this function.
  • Set your settings in the ACRCloudConfig object and pass it to this function.
  • We suggest this function also be called only once in the lifecycle of your application.

Fields of ACRCloudConfig:

Name Type Description
reqMode ACRCloudRecMode Recognition mode

public enum ACRCloudRecMode {
REC_MODE_REMOTE, // remote recognition
REC_MODE_LOCAL, // local recognition

accessKey String Access key of your ACRCloud project
accessSecret String Access secret of your ACRCloud project
host String String meaning depends on reqMode:
REC_MODE_REMOTE: the host of server
REC_MODE_LOCAL: local fingerprinting database directory
acrcloudListener IACRCloudListener Callback object
context Context Context parameter: this
requestTimeout int Http request timeout, default is 5000ms

Notes about Offline (Local) Recognition:

  • Local fingerprinting database is used when you use REC_MODE_LOCAL.
  • Local fingerprinting database directory contains two files: *.iv and *.df.
  • *.iv is the fingerprint indexing file which is created in your ACRCloud Dashboard.
  • *.df is the metadata of resources in your fingerprinting database.
  • You can customize the format of *.df, but the order of the lines


  • When you don’t use the ACRCloudClient instance anymore, call this function to free system resources.
  • Caution: For Local (Offline) Recognition, forgetting to call this function will cause memory leak.


  • This function will automatic start the recording and recognizing process.
  • When there’s a result, callback functions of the IACRCloudListener callback object from ACRCloudConfig will be called.
  • The whole recognition time is controlled by ACRCloud’s Server.
  • You can call the stop function (see 2.5) to terminate this process.


public void stopRecordToRecognize();

  • This function is for humming recognition only, it will stop the recording and start recognizing immediately.


  • This function will cancel the recognition immediately.


  • Recognize the audio content stored in the buffer parameter.
  • Audio format: RIFF, PCM, 16 bit, mono 8000 Hz.
  • It doesn’t start the recording process any more.
  • This is a synchronised function and it will wait until a result returns.
  • Because “Android UI Main Thread” can not send network requests, you must call this function in a child thread.


  • Create fingerprint from audio buffer.
  • Audio format: RIFF, PCM, 16 bit, mono 8000 Hz.
  • @return null: creates a fingerprint error.


  • Pre-record audio via microphone, it makes recognition much faster (recommended).
  • recordTimeMS: Audio recorded in last x milliseconds.


IACRCloudListener is the callback object interface that could be used during the recording and recognizing process. You can implement this interface yourself.


  • This function will be called if there is any result during and after the startRecognize function is called.

Notes about the result parameter
It is a JSON string, sample format:

Array format, the fields is user-defined.


  • This function is designed to tell you the audio volume whilst recording.
  • You can use the real-time volume information to create an interactive UI.

Demo project

We provide a demo project for users to understand the mechanism of our SDK and take allows users to use it for reference.

Project Settings

  • Import acrcloud-android-sdk-(version).jar
    Create a libs directory. Then copy acrcloud-android-sdk-(version).jar from the development kit to the new directory. If version of EclipseADT is below 17, right-click the project and select “Build Path”>”Configure Build Path…”>”Libraries”. Use “Add Jars…” to import acrcloud-android-sdk-(version).jar from libs.
  • Import the dynamic Library (
  • Add permissions to AndroidManifest.xml

Run the Demo

See: Android Demo.