android - 为什么 Android (Jelly Bean) 忽略额外的 RecognizerIntent (Kõnele)?

标签 android android-intent android-4.2-jelly-bean

我安装了开源Kõnele ( source code ) 目的是研究如何编写和注册自定义语音识别服务。作为第一步,在深入研究源代码之前,我尝试验证它是否确实按我的预期工作。因此,我进入手机的系统设置 > 语言和输入 > 语音识别器并选择 Kõnele 作为系统的识别器:

enter image description here

然后,我尝试了手机中的各种应用程序,这些应用程序在键盘上显示了麦克风选项,期望当我触摸麦克风符号时,将使用 Kõnele。然而,系统总是弹出 Google 的内置语音搜索。

这是为什么?

我是否错过了需要(作为用户)配置的其他设置才能完成此操作?

这是 Android 操作系统的“设计”限制吗?

是否可以告诉 Android 始终使用 Google 语音搜索之外的其他 RecognizerIntent?如果是这样,怎么办?

更新:我设法找到一个应用程序似乎不会忽略额外的RecognizerIntent:Google Maps:

enter image description here

对我来说,这表明这与 Android Intent 解析有关。但为什么有些应用程序不会触发“使用以下命令完成操作”对话框,而 Google map 却会触发该对话框?

最佳答案

我认为您已经做了作为用户所能做的一切,但是想要使用语音识别器的应用程序当然可以忽略您的配置。例如。它可以通过构建如下所示的识别器来直接选择特定的语音识别器实现:

SpeechRecognizer.createSpeechRecognizer(this,
    new ComponentName("com.google",
                      "com.google.Recognizer");
);

在这种情况下,您唯一的选择是卸载或禁用此特定实现,并希望应用程序回退到通用方法:

SpeechRecognizer.createSpeechRecognizer(this);

不幸的是,在某个时候,Google 开始推广应用程序直接链接到 Google 语音识别器的想法(请参阅 Add Voice Typing To Your IME )。现在很多键盘应用程序都这样做(例如 the issue that I raised with SwiftKey ),而您唯一的选择就是找到一个不这样做的...

应用程序也可能发送 Kõnele 不支持的 Intent (支持的 Intent 列在 manifest 中),但在语音识别应用程序中支持该 Intent 是有意义的。在本例中,这将是对 Kõnele 的功能请求。

关于android - 为什么 Android (Jelly Bean) 忽略额外的 RecognizerIntent (Kõnele)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19850597/

相关文章:

android - 如何显示自定义 fragment 的 ListView ?

android - 在 Android 中将 dip 转换为 px

android - 如何让Android Camera Intent返回全尺寸图片

android - 垃圾回收在 Android 4.2 Jelly bean Dalvik VM 中是如何工作的?

android - Android 上的工作目录 : null environment when running Process. Builder

超过 4k 个字符的 Android TTS 文本无法播放

android - achartengine 清除 XYMultipleSeriesRenderer 中的渲染器

android - 使用 editText 中的内容分配一个字符串变量

Android:下载文件然后显示应用程序选择器打开它?

android - 通知服务在通知点击上增加了额外的费用,怎么样?