android - 如果没有听到任何内容,Google Speech Recongizer 不会返回代码
问题描述
我需要检测用户是否没有说话。我正在使用以下意图来获取 Google 语音对话。有没有办法来解决这个问题?
public void askSpeechInput() {
Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
i.putExtra(RecognizerIntent.EXTRA_PROMPT, "Say Something!");
i.putExtra(String.valueOf(RecognizerIntent.RESULT_CLIENT_ERROR), "Say Something!");
i.putExtra(String.valueOf(RecognizerIntent.RESULT_AUDIO_ERROR), 201);
i.putExtra(String.valueOf(RecognizerIntent.RESULT_SERVER_ERROR), 202);
startActivityForResult(i, 200);
refreshVoiceSettings();
}
解决方案
推荐阅读
- reactjs - setState() 导致状态变量未定义
- angular - Angular 7将对象与对象数组映射到垫表
- javascript - JavaScript:在进度条上停止动画
- firebase - 从将数据推送到您打开的 websocket 的提供程序将外部数据导入 Firestore?
- sql - where 语句取消了结果?
- scala - Kubernetes kafka - lagom - 消费者在超时后因 WakeupException 而中断。消息:空
- ios - view.addSubview(: ) Not working in swift playgrounds
- asp.net-core - Automapper v8 不忽略 EF(实体框架)类的导航属性
- arrays - 在 VBA 中存储字符串并输出到多个单元格
- sql - 将商或更长的表达式分配给局部(实)变量 T SQL