是否可以自定义android佩戴SpeechRecognizer UI?

时间:2014-10-03 17:17:34

标签: android speech-recognition wear-os

我在Android Wear中实现了SpeechRecognizer,但这个用户界面与“Ok Google”ui相同,因此让用户相信他们正在与我们的应用对话,实际上他们正在与“Ok Google”用户界面进行对话。

有没有办法自定义SpeechRecognizer用户界面,以便我们可以避免这种混淆?

2 个答案:

答案 0 :(得分:1)

目前我不这么认为。当我尝试它时,我收到此错误消息" SpeechRecognizer:没有选择的语音识别服务"。看看谷歌眼镜似乎基于这些信息它不可用但可能会变成这样。希望Android Wear也是如此。

Is it possible to have Android Voice Recognition (as a custom service) on Google Glass?

答案 1 :(得分:1)

Sure, it's possible to use a custom ui. Create one, show it and run the recognizer from code

     sr = SpeechRecognizer.createSpeechRecognizer(getApplicationContext());
    sr.setRecognitionListener(new Speachlistener());
    if (recognizerIntent == null) {
        recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        //intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getApplication().getPackageName());
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 5);
    }

    try{
        sr.startListening(recognizerIntent);
    }catch (Exception e) 
    {}