Launch Preinstalled App from activity (Google Voice Search) Android

耗尽温柔 提交于 2019-12-04 16:30:10

I ran into the exact same problem. It seems to be caused by the way google has packaged up the voice component in ICS. It's not a standalone app anymore. It's integrated into the search bar through the general search app.

The fix is really easy:

Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
startActivity(intent);

I found this through this tutorial that's more about general speech recognition: http://www.jameselsey.co.uk/blogs/techblog/android-how-to-implement-voice-recognition-a-nice-easy-tutorial/

There's some code in there to verify that the voice recognizer is installed:

PackageManager pm = getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(
    new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
    if (activities.size() == 0)
    {
        speakButton.setEnabled(false);
        speakButton.setText("Recognizer not present");
    }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!