android 语音识别
Voice recognition has gained a lot of traction over the past few years. When building an app where you feel speech recognition would boost your user experience, you can either:
语音识别在过去几年中获得了很大的关注。 在构建您认为语音识别可以提升用户体验的应用程序时,您可以:
Integrate
SpeechRecognizer
API.集成
SpeechRecognizer
API。- Leverage Google Assistant. 利用Google Assistant。
Implementing SpeechRecognizer
in your Android application is straightforward. I’ll provide a detailed implementation later in the article.
在Android应用程序中实现SpeechRecognizer
很简单。 我将在本文后面提供详细的实现。
However, we want continuous voice recognition. Unfortunately, the API doesn’t provide a mechanism to trigger voice recognition using a keyword. All voice recognition systems are based on this pattern, whether it’s “Ok Google” for Google Assistant, “Hey Siri” for iOS, or “Alexa” for Amazon devices.
但是,我们需要连续的语音识别。 不幸的是,API没有提供使用关键字触发语音识别的机制。 所有语音识别系统均基于此模式,无论对于Google Assistant是“ Ok Google”,对于iOS是“ Hey Siri”,还是对于亚马逊设备是“ Alexa”。
For that, the second option should fit our needs. Sadly, Google Assistant remains a closed API and doesn’t offer many possibilities. It provides App Action, but you won’t achieve continuous voice recognition with it.
为此,第二种选择应符合我们的需求。 令人遗憾的是,Google Assistant仍然是封闭的API,并没有提供很多可能性。 它提供了App Action ,但是您将无法实现连续的语音识别。
I was excited when I first came across VoiceInteractionService
. It seemed to do what I wanted with the