我使用 Android 4.1.2 开发了一个应用程序,语音转文本功能运行良好,但当我在 Google Glass 上尝试时,它不起作用(未找到 Activity 异常)。 这是我的语音转文本代码
Intent intent = new Intent(
RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");
try {
startActivityForResult(intent, requestCode);
} catch (ActivityNotFoundException a) {
Toast t = Toast.makeText(getApplicationContext(),
"Opps! Your device doesn't support Speech to Text",
Toast.LENGTH_SHORT);
}
我尝试手动安装语音合成 apk,但当我尝试启动语音合成应用程序时崩溃了。有没有办法安装语音合成器,或者是否有解决方法代码可以让语音转文本在 Google Glass 中工作?
最佳答案
要使用标准 Android 语音识别,您必须安装/部署 com.google.android.voicesearch apk 包 (Voicesearch.apk的版本必须是Android 4.0或更高版本自带的版本,旧版本的Voicesearch.apk不支持)
只需使用 adb install < apk-file > 安装即可
然后您应该能够在玻璃设备上使用 Android 的语音识别功能。
更新:Google Glass 更新至 XE9 后,您无需安装 Voice Apk。默认的就可以正常工作。 卸载语音搜索 使用以下命令
adb uninstall com.google.android.voicesearch
关于android - 如何在 Google Glass 中安装语音转文本功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18073695/