ASR/TTS Demo-Android Guide
demo-android is used to verify ASR/TTS SDK integration, connection setup, and call flows. In a private deployment, configure the Demo with the private domain, asrPath, ttsPath, API Key, and other required parameters to verify that the full speech chain is available.
1. Get the Demo project
- Download: online-speech-sdk-demo.zip
After downloading, unzip the package and enter the online-speech-sdk-demo directory to build and debug.
2. Build and install
bash
cd online-speech-sdk-demo
./gradlew :demo-android:assembleDebugAPK output:
demo-android/build/outputs/apk/debug/demo-android-debug.apk
3. Configuration
The Demo reads the following values from online-speech-sdk-demo/gradle.properties by default:
online.demo.domainonline.demo.akonline.demo.skonline.demo.uidonline.demo.deviceIdonline.demo.asrPathonline.demo.ttsPath
4. Pages
4.1 Initialization page
Init SDK (create clients): Create the SDK, ASR client, and TTS client.Close SDK + Unbind: Release SDK resources and connections, and unbind the open-sdk service.
4.2 ASR page
connect(): Establish the ASR WebSocket.startAsrWithMic(): Record through open-sdk and stream audio automatically.stopAsrWithMic(): Stop recording and finish ASR.close(): Close the ASR connection.
4.3 TTS page
connect(): Establish the TTS WebSocket.speak(default text): Play the default test text.stop(): Stop current TTS playback.close(): Close the TTS connection.
5. Debug logs
- Log area at the bottom of the page: latest logs appear at the top.
- Logcat tags:
OnlineSpeechDemoOpenSdkAudioSourceAndroidPcmTtsPlayer
Recommended filter:
bash
adb logcat | rg "OnlineSpeechDemo|OpenSdkAudioSource|AndroidPcmTtsPlayer"6. FAQ
EACCES / Download/glass3Log: The Demo skipsGlassSdk.registerClient()by default to avoid Android 12 public directory write permission issues.- No ASR result: make sure
connect()is called beforestartAsrWithMic(). - No TTS audio: make sure
connect()is called, then check device volume and audio routing.