This library lets you perform continuous voice recognition in your android app with options to either use Google Voice Ime in a Dialog or perform the recognition in-app. It also provides you with an option to force android to use ONLY its offline speech recognition engine for processing.

Programming language: Java
License: MIT License
Latest version: v1.0.0-beta.1

Android-Speech-Recognition alternatives and similar packages

Based on the "Animations" category.
Alternatively, view Android-Speech-Recognition alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Android-Speech-Recognition or a related project?

Add another 'Animations' Package


License: MIT

Android Speech Recognition

This library lets you perform continuous voice recognition in your android app with options to either use Google Voice Ime in a Dialog or perform the recognition in-app. It also provides you with an option to enforce ONLY offline speech recognition.



Add the Jitpack repository to your root build.gradle file

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }

Add the dependency to your app's build.gradle file

dependencies {
    compile 'com.github.maxwellobi:android-speech-recognition:v1.0.0-beta.1'


Add the repository to your pom.xml file


Add the dependency



To use SpeechRecognition library, initialize it, set a listener for handling callbacks, then start listening.

protected void onCreate(Bundle savedInstanceState) {

    SpeechRecognition speechRecognition = new SpeechRecognition(this);

    Button speakButton = findViewById(R.id.button);
        speakButton.setOnClickListener(new View.OnClickListener(){
        public void onClick(View view) {

Handling Permissions

By default, SpeechRecognition handles the request to grant RECORD_AUDIO permission internally and provides a callback via OnSpeechRecognitionPermissionListener interface. There is no need to request this permission in your manifest.

public void onPermissionGranted() {
    //RECORD_AUDIO permission was granted
public void onPermissionDenied() {
    //RECORD_AUDIO permission was denied

Note: use SpeechRecognition.handleAudioPermissions(false) to disable this behavior. If this is set but the permission was not granted, SpeechRecognition will throw a SecurityException

Note: Runtime permission request is available from API level 23 (Marshmallow). Lower API levels will request permissions on install, thus no callback will be triggered.


To receive the speech recognition result and other event notification, you need to implement the OnSpeechRecognitionListener

public void OnSpeechRecognitionStarted() {}

public void OnSpeechRecognitionStopped() {}

public void OnSpeechRecognitionFinalResult(String s) {
    //triggered when SpeechRecognition is done listening.
    //it returns the translated text from the voice input
public void OnSpeechRecognitionCurrentResult(String s) {
    //this is called multiple times when SpeechRecognition is
    //still listening. It returns each recognized word when the user is still speaking
public void OnSpeechRecognitionError(int i, String s) {}

Note OnSpeechRecognitionCurrentResult will NOT be called if your are using the GoogleVoiceIme dialog.


Method Default Description
setContext(Context) Null Use this to change SpeechRecognition current context
setPreferredLanguage(String) - Not yet implemented
handleAudioPermissions(boolean) true set false to handle audio permissions yourself. If false, then no need to setSpeechRecognitionPermissionListener()
useOnlyOfflineRecognition(boolean) false set true to force android to use its Offline Recognition Engine. By default, android uses either or both online and offline. false is recommended.
isSpeechRecognitionAvailable() - returns true or false whether the device supports speech recognition or not
useGoogleImeRecognition(boolean, String) false whether to use GoogleVoiceIme Dialog or not. If true, set a prompt to display on the dialog or null to use default.
startSpeechRecognition() - start listening for voice input
stopSpeechRecognition() - dispose resources


See SpeechRecognizer class for error definitions.


Copyright (c) 2018 Maxwell Obi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

*Note that all licence references and agreements mentioned in the Android-Speech-Recognition README section above are relevant to that project's source code only.