Android

Register an account for free if you don’t have one.

Identify Music or TV with Android SDK

This demo shows how to identify music ( songs ) or detect live TV channels by recorded sound with ACRCloud Android SDK. Contact us if you have any question or special requirement about the SDK: support@acrcloud.com

Preparation

  • The newest ACRCloud Android SDK which contains the demo project developed with Android Studio IDE.
  • If you want to recognize music, you need a Audio Recognition project. ( See How to Recognize Music )
  • If you want to detect tv channels, you need a Live Channel Detection project. ( See How to Detect Live TV Channels )
  • Save the information of “host”, “access_key”, “access_secret” of your project.
  • Make sure you have setup the Android Development Environment well.

Step 1

Download the newest ACRCloud Android SDK and unzip it.

Make sure you can find the folder named ACRCloudSDKDemo with AndroidManifest.xml in it.

Step 2

Open Android Studio, and select “Open an existing Android Studio project“, and find the folder named “ACRCloudSDKDemo“.

 

Confirm the following points.

Step 3

Edit MainActivity.java, update “this.mConfig.host”, “this.mConfig.accessKey” and “this.mConfig.accessSecret” with the corresponding values of your project.

Step 4

Make sure you have an Android device connected to “Android Studio”, and run this project.

Now you can test recognizing contents in the buckets of your project. Press “start” to activate the audio recognition process.

Picture1

Recognition Mode

this.mConfig.reqMode

1.  ACRCloudConfig.ACRCloudRecMode.REC_MODE_REMOTEis for Audio & Video RecognitionLive Channel DetectionHybrid Recognitionit’s online recognition.

2. ACRCloudConfig.ACRCloudRecMode.REC_MODE_LOCAL:  is for Offline Recognition.

(1) Put your offline db files(afp.iv, afp.df, afp.op) to a directory of your SD;

(2) Set “this.mConfig.reqMode” to “ACRCloudConfig.ACRCloudRecMode.REC_MODE_LOCAL“;

(3) Set “this.mConfig.dbPath” to the directory of “offline db files“(For example: /sdcard/acrcloud/model) that this App can access.

(4) Run this project.

One-Time and Loop Recognition

1. If you want to recognize only once in a session, please add the following code.

2. If you need to recognize cyclically, please remove the codes [ this.mClient.cancel() ].

Open Prerecording Recognition

Open prerecording will make the recognition much more faster.

If you want to open this feature, please call void startPreRecord(int recordTime)
The parameter recordTime is the prerecording time. The recommend value is 3000-4000

What’s Next

See Android SDK Reference and Android SDK ( for file ) Reference to start integration.