百度语音

需要添加的文件

将以下文件放入工程的libs下

路径文件名
SDK\libsspeech-release.aar、speech_baidu-release.aar

AndroidManifest.xml配置

权限配置

  1. <uses-permission android:name="android.permission.RECORD_AUDIO" />
  2. <uses-permission android:name="android.permission.INTERNET" />
  3. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  4. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  5. <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
  6. <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  7. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

application节点配置

  1. <meta-data android:name="com.baidu.speech.APP_ID" android:value="${百度语音申请的appid}"/>
  2. <meta-data android:name="com.baidu.speech.API_KEY" android:value="${百度语音申请的apikey}"/>
  3. <meta-data android:name="com.baidu.speech.SECRET_KEY" android:value="${百度语音申请的secretkey}"/>
  4. <service android:name="com.baidu.speech.VoiceRecognitionService" android:exported="false" />

dcloud_properties.xml配置

dcloud_properties.xml文件在assets/data目录下

features节点下设置

  1. <feature name="Speech" value="io.dcloud.feature.speech.SpeechFeatureImpl">
  2. <module name="baidu" value="io.dcloud.feature.speech.BaiduSpeechEngine"/>
  3. </feature>

讯飞语音

需要添加的文件

将以下文件放入工程的libs下

路径文件名
SDK\libsspeech-release.aar、speech_ifly-release.aar

AndroidManifest.xml配置

权限配置

  1. <uses-permission android:name="android.permission.RECORD_AUDIO" />
  2. <uses-permission android:name="android.permission.INTERNET" />
  3. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  4. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  5. <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
  6. <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  7. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

application节点配置

  1. <meta-data
  2. android:name="IFLY_APPKEY"
  3. android:value="${讯飞语音申请的appid}" />

dcloud_properties.xml配置

dcloud_properties.xml文件在assets/data目录下

features节点下设置

  1. <feature name="Speech" value="io.dcloud.feature.speech.SpeechFeatureImpl">
  2. <module name="iFly" value="io.dcloud.feature.speech.IflySpeechEngine"/>
  3. </feature>

发现错误?想参与编辑?在 GitHub 上编辑此页面!