异常在以下代码中抛出:
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo");
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);.
我用谷歌搜索发现这是因为 the voice search app我正在使用的设备上缺少来自 google 的内容。我可以通过手动安装应用程序来解决问题,但是我怎么才能通过程序安装 apk,比如导入一些库或其他~
非常感谢。
最佳答案
在 WebView 中打开应用程序(您要使用的)的链接
作为
try{
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo");
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);.
}
catch(ActivityNotFoundException e)
{
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://market.android.com/details?id=APP_PACKAGE_NAME"));
startActivity(browserIntent);
}
替换 https://market.android.com/details?id=APP_PACKAGE_NAME 中的 APP_PACKAGE_NAME市面上的语音识别应用包名
关于android - 找不到处理 Intent { act=android.speech.action.RECOGNIZE_SPEECH(有附加功能)} 的 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9479846/