如何显示在我的应用程序的谷歌语音识别设置? [英] how to show up the google voice recognition settings in my app?

查看:221
本文介绍了如何显示在我的应用程序的谷歌语音识别设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作中,我已经实现了语音识别和语音合成一个Android应用程序。所以我想,推出设置画面为谷歌语音识别和语音合成,让用户从应用程序中更改设置。 我已经实现TTS设置成功地通过使用以下code:

I am working on an android application in which i have implemented voice recognition and TTS. So i was thinking to launch settings screen for both google voice recognition and TTS to allow user to change settings from within the application. I have implemented TTS settings successfully by using following code:

intent = new Intent();
intent.setAction("com.android.settings.TTS_SETTINGS");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);

现在我想在我的应用显示系统的谷歌语音识别设置允许用户更改语言选项等等。我寻觅了很多......做了很多打击和尝试,但未能加载语音识别设置屏幕。请告诉我怎样可以实现这一点。 在此先感谢...

Now I want to show system's "google voice recognition settings" in my application to allow user to change language options etc. I have searched a lot... Done a lot of hit and try but failed to load voice recognition settings screen. Please tell me how i can implement that. Thanks in advance...

推荐答案

我被困在此的年龄太...

I was stuck on this for ages too...

    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setComponent(newComponentName("com.google.android.voicesearch","com.google.android.voicesearch.VoiceSearchPreferences"));
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    this.startActivity(intent);
    }

希望它为您做太...

Hope it does for you too...

编辑:正如在评论中,这在果冻豆版本的谷歌搜索应用程序的改变。为了赶上,你不能使用Build.Version任何潜在的更新问题,你可以使用这些方针的东西:

As pointed out in the comments, this changed in the Jelly Bean version of the Google Search App. To catch any potential update issues where you can't use Build.Version, you can use something along these lines:

try {
final Intent vsInt = new Intent(Intent.ACTION_MAIN);
vsInt.setComponent(new ComponentName("com.google.android.voicesearch",
                            "com.google.android.voicesearch.VoiceSearchPreferences"));
vsInt.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(vsInt);

} catch (final Exception e) {

try {
final Intent vsjInt = new Intent(Intent.ACTION_MAIN);
vsjInt.setComponent(new ComponentName("com.google.android.googlequicksearchbox", "com.google.android.voicesearch.VoiceSearchPreferences"));
vsjInt.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(vsjInt);

} catch (final Exception e1) {
e1.printStackTrace();
}
}

这篇关于如何显示在我的应用程序的谷歌语音识别设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆