【问题标题】:How can I programmatically read out which speech recognition is selected in Android?如何以编程方式读出在 Android 中选择了哪个语音识别?
【发布时间】:2012-07-25 10:59:15
【问题描述】:

我想读出手机中选择的语音识别。

默认情况下,会安装并选择 Google 语音搜索。

一些设备还安装了 Vlingo 语音识别。

如何以编程方式读出选择了哪个语音识别?

谁能帮帮我?

【问题讨论】:

  • 欢迎来到 SO。让你开始吧。您可以按照本教程androidhive.info/2012/01/android-text-to-speech-tutorial 进行操作,如果您在某个点遇到异常或某些问题时遇到问题。我们是来帮忙的。快乐编码:)
  • 感谢您的快速回答;)我已经完成了所有工作并且工作正常。现在我需要知道选择了哪个语音识别。谁能给我一个示例代码或链接?
  • @Abhilasha 他说的是语音识别,而不是文本到语音。我想知道你是否读过这个问题..

标签: android speech-recognition


【解决方案1】:

如果您没有找到解决方案,您需要执行以下操作:

final List<ResolveInfo> services = context.getPackageManager().queryIntentServices(
        new Intent(RecognitionService.SERVICE_INTERFACE), 0);

String packageName = "";
String serviceName = "";

for (final ResolveInfo info : services) {

    packageName = info.serviceInfo.packageName;
    serviceName = info.serviceInfo.name;

    if (packageName != null && serviceName != null) {
    // Do something with the output here
    }
}

这是我使用from this answer的改编。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-06
    • 1970-01-01
    • 1970-01-01
    • 2011-01-11
    相关资源
    最近更新 更多