In Android while using SpeechRecognizer, I have noticed that SpeechRecognizer stopped listening automatically in few seconds.
I am working on an app that requires continuous speech input from the user. Our app needs to work without internet. For speech recognition we are using SpeechRecognizer class.
Below is the implementation: (in Kotlin)
var recognizer = SpeechRecognizer.createSpeechRecognizer(this.applicationContext)
recognizer!!.setRecognitionListener(RecognitionListener(this))
To start Listening
val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, "com.taazaa.texttospeechdemo")
recognizer!!.startListening(intent)
This is working fine until user takes a pause while speaking.
I need following implementation:
SpeechRecognizer should not stop listening until user manually stop recognition.
recognizer!!.stopListening()
Everytime when recognition starts or stops device makes a beep sound which I need to stop.
App should work in Offline Mode mostly.
let me know what I am doing wrong and what need to implement to support above two points. Google Bolo is doing this so there could be a way. Google bolo: https://play.google.com/store/apps/details?id=com.google.android.apps.seekh&hl=en_IN
I tried many links and some of them are mentioned below:
Offline Speech Recognition in Android
Offline Speech Recognition In Android (JellyBean)