【问题标题】:Voice Recognizer Access on Kindle Fire HD 6Kindle Fire HD 6 上的语音识别器访问
【发布时间】:2016-12-16 16:06:18
【问题描述】:

我正在开发一个在 Kindle Fire 上使用的增强通信应用程序。我使用 Fire HD 6 作为我的测试设备。我在 Xamarin 中工作,C#。

知道当麦克风图标出现在键盘上时,设备上有一个语音识别器,我可以使用它来填充搜索窗口。但是,我的安卓语音识别器代码不起作用。我收到“识别器不存在”错误。这是我正在使用的代码:

public class VoiceRecognition : Activity
{
private static String TAG = "VoiceRecognition";
private const int VOICE_RECOGNITION_REQUEST_CODE = 1234;
private ListView mList;
public Handler mHandler;
private Spinner mSupportedLanguageView;

protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
mHandler = new Handler();

SetContentView(Resource.Layout.Main);
Button speakButton = FindViewById<Button>(Resource.Id.btnRecord);

// Check to see if a recognition activity is present
PackageManager pm = PackageManager;
IList<ResolveInfo> activities = pm.QueryIntentActivities(new Intent(RecognizerIntent.ActionRecognizeSpeech), 0);

if (activities.Count != 0)
speakButton.Click += speakButton_Click;
else
{
speakButton.Enabled = false;
speakButton.Text = "Recognizer not present";
}

}

这段代码显然行不通,但我不知道从哪里开始。如何访问此设备上的语音识别器?

谢谢!

【问题讨论】:

    标签: c# android xamarin.android voice-recognition kindle-fire


    【解决方案1】:

    您可以尝试通过SpeechRecognizer 连接到语音识别器(大多数键盘应用都这样做)。

    要尝试的另一件事是调用 RecognizerIntent 活动时的另一个操作,例如还有ACTION_WEB_SEARCH

    【讨论】:

      【解决方案2】:

      但是,我的 Android 语音识别器代码无法正常工作。我收到“识别器不存在”错误。

      您似乎正在使用适用于 android 设备的标准语音 API,如果您确定自己的代码并启用了这些功能,但语音识别器仍然无法正常工作,我认为您可能需要遵循Kindle 的官方 API,而不是遵循标准的 android API。

      看看这个官方文档:Alexa Voice Service API Overview,它似乎使用HTTP 来发送和接收SpeechRecognizer 的JSON 格式的消息。你可以试试看。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-10-20
        • 1970-01-01
        相关资源
        最近更新 更多