Skip to main content

Fun-ASR-Realtime HarmonyOS SDK

Prerequisites

  1. Obtain and configure an API Key. Do not hardcode long-term API Keys in mobile apps. We recommend that your app server generate a temporary API Key and then distribute it to the client.
  2. Download the latest SDK integration package. After extracting it, copy entry/libs/neonui.har to the entry/libs folder of your app project, and add the dependency in entry/oh-package.json5:
    {
      "dependencies": {
        "neonui": "file:libs/neonui.har"
      }
    }
    
    To integrate through HarmonyOS C++ interfaces, you can use the dynamic libraries in the native/libs folder and the header files in the native/include folder of the integration package.
  3. Declare the network and microphone permissions in your app's module.json5, and request the microphone permission at runtime. reason_internet and reason_microphone are example resource names; define the corresponding descriptions in your app resources.
    "requestPermissions": [
      {
        "name": "ohos.permission.INTERNET",
        "reason": "$string:reason_internet",
        "usedScene": { "abilities": ["EntryAbility"], "when": "always" }
      },
      {
        "name": "ohos.permission.MICROPHONE",
        "reason": "$string:reason_microphone",
        "usedScene": { "abilities": ["EntryAbility"], "when": "always" }
      }
    ]
    

QuickStart

Use DevEco Studio to open the sample project in the integration package. The sample page is located at entry/src/main/ets/pages/dashscope/DashFunAsrSpeechTranscriberPage.ets. Configure an API Key and you can run it. Use model fun-asr-realtime in the example.

Reference