语音识别命令Android

时间:2011-06-14 19:18:09

标签: android command speech-recognition voice voice-recognition

因此,当用户想要执行语音命令但无法找到任何解决方案时,我已经广泛搜索了有关删除Google语音识别UI对话框的问题的某种解决方案。我正在尝试实现一个向用户显示菜单的应用程序,用户可以点击选项或大声说出可打开新页面的选项。到目前为止,除非我使用Googles RecognizerIntent,否则我无法实现此功能,但我不希望弹出对话框。有人有主意吗?或者是否有人解决了这个问题或找到了解决方法?感谢

编辑:作为妥协,也许有办法将对话框移动到屏幕底部,同时仍然可以查看我的菜单?

2 个答案:

答案 0 :(得分:1)

How can I use speech recognition without the annoying dialog in android phones有帮助吗?

我很确定Nuance / Dragon对使用其服务的生产或商业应用程序收费。如果这只是一个演示,您可以使用开发者帐户。所有Android应用程序都免费提供Android语音服务。

答案 1 :(得分:1)

您知道可以使用Google的API执行此操作。

您可能一直在查看语音识别意图的文档。而是查看语音识别API的RecognitionListener接口。

以下是一些可以帮助您的代码

public class SpeechRecognizerExample extends Activity implements RecognitionListener{    

    //This would go down in your onCreate

    SpeechRecognizer recognizer = SpeechRecognizer.createSpeechRecognizer(this);
    recognizer.setRecognitionListener(this);

    //Then you'd need to start it when the user clicks or selects a text field or something

    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    //intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "zh");
    intent.putExtra("calling_package",
            "yourcallingpackage");

    recognizer.startListening(intent);

    //Then you'd need to implement the RecognitionListener functions - basically works just like a click listener

以下是RecognitionListener的文档:

http://developer.android.com/reference/android/speech/RecognitionListener.html