How to Use Speech Recognition Without the Annoying Dialog in Android Phones

How can I use speech recognition without the annoying dialog in android phones

Use the SpeechRecognizer interface. Your app needs to have the RECORD_AUDIO permission, and you can then create a SpeechRecognizer, give it a RecognitionListener and then call its startListening method. You will get callbacks to the listener when the speech recognizer is ready to begin listening for speech and as it receives speech and converts it to text.

Speech Recognition without default Activity/Intent

Found out how. This post was an excellent step in the right direction.

I just needed to implement RecognitionListener.

Speech recognition without Google dialog boxes

You've missed:

mSpeechRecognizer.setRecognitionListener();

The parameter will be either be the context which implements the listener, or the custom listener you've created.

At the moment your code is not setting the listener, you just have the listener code.

Edit: If you do not implement RecognitionListener, then you can do it this way:

mSpeechRecognizer.setRecognitionListener(new RecognitionListener() {

@Override
public void onBeginningOfSpeech() {
// TODO Auto-generated method stub

}

@Override
public void onBufferReceived(byte[] arg0) {
// TODO Auto-generated method stub

}

@Override
public void onEndOfSpeech() {
// TODO Auto-generated method stub

}

@Override
public void onError(int arg0) {
// TODO Auto-generated method stub

}

@Override
public void onEvent(int arg0, Bundle arg1) {
// TODO Auto-generated method stub

}

@Override
public void onPartialResults(Bundle partialResults) {
// TODO Auto-generated method stub

}

@Override
public void onReadyForSpeech(Bundle params) {
// TODO Auto-generated method stub

}

@Override
public void onResults(Bundle results) {
// TODO Auto-generated method stub

}

@Override
public void onRmsChanged(float rmsdB) {
// TODO Auto-generated method stub

}

});


Related Topics



Leave a reply



Submit