1.非Intent方式,没有google语音识别的界面
private void initGoogleSpeechRecognizer() {
speechGoogle = android.speech.SpeechRecognizer.createSpeechRecognizer(this);
speechGoogle.setRecognitionListener(recognitionListener);
recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.getDefault().toString());
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault().toString());
// only for 6.0
recognizerIntent.putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE<