Google Wear在模拟器中的语音识别器没有语音输入 [英] Speech Recognizer on Google Wear in Emulator no voice input

查看:132
本文介绍了Google Wear在模拟器中的语音识别器没有语音输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用Google Wear网站上的自由格式语音输入.

I was trying to use the Free-form Speech Input from Google Wear site.

在hello world示例中,我刚刚添加了对textView的单击.它确实从语音意图中启动了立即讲话"活动,但是仿真器无法检测到我的麦克风中的任何声音.

From the hello world example, I just added a click on textView. It does bring up the Speak Now activity from the speech intent, but the emulator was not able to detect any sound from my mic.

我正在使用Mac OS 10.9.3,已经尝试了手表的机械和智能两种版本,并检查了AVD创建中存在的硬件键盘.该文档说有一个系统内置的Speech Recognizer,所以像在移动仿真器中那样安装Google Voice应用似乎是错误的答案?

I'm using Mac OS 10.9.3, I've tried both arm and intel version of the wear watch, and checked the hardware keyboard present on the AVD creation. The documentation said there is a system built-in Speech Recognizer, so installing the Google Voice app like you might do in a mobile emulator seems to be a wrong answer?

public class MainActivity extends Activity {

private TextView mTextView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
    stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
        @Override
        public void onLayoutInflated(WatchViewStub stub) {
            mTextView = (TextView) stub.findViewById(R.id.text);
            mTextView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    displaySpeechRecognizer();
                }
            });
        }
    });
}


private static final int SPEECH_REQUEST_CODE = 0;

// Create an intent that can start the Speech Recognizer activity
private void displaySpeechRecognizer() {
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);

    // Start the activity, the intent will be populated with the speech text
    startActivityForResult(intent, SPEECH_REQUEST_CODE);
}

// This callback is invoked when the Speech Recognizer returns.
// This is where you process the intent and extract the speech text from the intent.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == SPEECH_REQUEST_CODE && resultCode == RESULT_OK) {
        List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
        String spokenText = results.get(0);
        // Do something with spokenText
    }
    super.onActivityResult(requestCode, resultCode, data);
}

}

推荐答案

我通过这篇帖子弄清楚了

I figured out by this post Receiving voice input from an Android wearable emulator that you could use the keyboard for input, i think for now thats okay

这篇关于Google Wear在模拟器中的语音识别器没有语音输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆