简体   繁体   English

语音识别指令 Android

[英]Voice Recognition Commands Android

So I've searched far and wide for some sort of solution to the issue regarding removing Google's Voice Recognition UI dialog when a user wants to perform a Voice Command but have been unable to find any solution.因此,当用户想要执行语音命令但无法找到任何解决方案时,我已经广泛搜索了有关删除 Google 语音识别 UI 对话框的问题的某种解决方案。 I am trying to implement an app which displays a menu to the user and the user can either click on the options or say the options out loud which will open the new pages.我正在尝试实现一个向用户显示菜单的应用程序,用户可以单击选项或大声说出将打开新页面的选项。 So far ive been unable to implement this unless I use Googles RecognizerIntent but I dont want the dialog box to pop up.到目前为止,除非我使用 Googles RecognizerIntent,否则我无法实现这一点,但我不希望弹出对话框。 Anyone have any ideas?有人有想法么? Or has anyone solved this issue or found a workaround?或者有没有人解决了这个问题或找到了解决方法? Thanks谢谢

EDIT: As a compromise maybe there is a way to move the dialog to the bottom of the screen while still being able to view my menu?编辑:作为一种妥协,也许有一种方法可以将对话框移动到屏幕底部,同时仍然能够查看我的菜单?

Does How can I use speech recognition without the annoying dialog in android phones help? 如何在 android 手机中使用语音识别而不出现烦人的对话

I'm pretty sure the Nuance/Dragon charges for production or commercial applications that use their services.我很确定 Nuance/Dragon 会对使用其服务的生产或商业应用程序收费。 If this is just a demo, you may be fine with the developer account.如果这只是一个演示,您可以使用开发者帐户。 Android speech services are free for all Android applications. Android 语音服务对所有 Android 应用程序都是免费的。

You know that you can do this with google's APIs.你知道你可以用谷歌的 API 来做到这一点。

You've probably been looking at the documentation for the speech recognition intent.您可能一直在查看有关语音识别意图的文档。 Look instead at the RecognitionListener interface to the speech recognition APIs.请查看语音识别 API 的 RecognitionListener 接口。

Here's some code to help you这里有一些代码可以帮助你

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

Here's the docs for a RecognitionListener:这是 RecognitionListener 的文档:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM