我制作了语音识别代码。 它被星系注释9撞毁了。
由于“不允许的语音识别服务”而崩溃
我尝试检查是否受支持。
SpeechRecognizer.isRecognitionAvailable(getApplicationContext())
它也是'false'。
mSoundIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
mSoundIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getPackageName());
mSoundIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "ko-KR");
mRecognizer = SpeechRecognizer.createSpeechRecognizer(this);
mRecognizer.setRecognitionListener(new RecognitionListener() {
@Override
public void onReadyForSpeech(Bundle params) {
}
@Override
public void onBeginningOfSpeech() {
}
@Override
public void onRmsChanged(float rmsdB) {
}
@Override
public void onBufferReceived(byte[] buffer) {
}
@Override
public void onEndOfSpeech() {
}
@Override
public void onError(int error) {
}
@Override
public void onResults(Bundle results) {
String key = ""; key = SpeechRecognizer.RESULTS_RECOGNITION;
ArrayList<String> mResult = results.getStringArrayList(key);
String[] rs = new String[mResult.size()];
mResult.toArray(rs);
mTvResult.setText(""+rs[0]);
}
@Override
public void onPartialResults(Bundle partialResults) {
}
@Override
public void onEvent(int eventType, Bundle params) {
}
});
mRecognizer.startListening(mSoundIntent);
如何解决韩文识别问题?