🎤 Cordova Plugin for Speech Recognition
Switch branches/tags
Nothing to show
Clone or download
Latest commit f998b16 May 17, 2018
Failed to load latest commit information.
src fix iOS low volume May 16, 2018
www Android: Recognition in the background (#7) Nov 23, 2016
.editorconfig Init Sep 29, 2016
.gitignore Extend Feb 23, 2017
CHANGELOG.md Release Nov 27, 2017
LICENSE Init Sep 29, 2016
README.md Merge pull request #51 from simone-compagnone/master Nov 27, 2017
package.json Release Nov 27, 2017
plugin.xml updated version in plugin.xml Jan 14, 2018



npm Platform Donate

This is a cordova plugin for Speech Recognition.


cordova plugin add cordova-plugin-speechrecognition

Supported Platforms

  • Android
  • iOS


This plugin requires internet connection.


  Function successCallback, Function errorCallback)

Result of success callback is a Boolean.


let options = {
  String language,
  Number matches,
  String prompt,      // Android only
  Boolean showPopup,  // Android only
  Boolean showPartial 

  Function successCallback, Function errorCallback, Object options)

This method has an options parameter with the following optional values:

  • language {String} used language for recognition (default "en-US")
  • matches {Number} number of return matches (default 5, on iOS: maximum number of matches)
  • prompt {String} displayed prompt of listener popup window (default "", Android only)
  • showPopup {Boolean} display listener popup window with prompt (default true, Android only)
  • showPartial {Boolean} Allow partial results to be returned (default false)

Result of success callback is an Array of recognized terms.

There is a difference between Android and iOS platforms. On Android speech recognition stops when the speaker finishes speaking (at end of sentence). On iOS the user has to stop manually the recognition process by calling stopListening() method.

If you set showPartial to true on iOS the success callback will be called multiple times until stopListening() called.


  Function successCallback, Function errorCallback)

Stop the recognition process. No return value.


  Function successCallback, Function errorCallback)

Result of success callback is an Array of supported languages.

// getSupportedLanguages result on Android:

let supportedLanguagesAndroid =
  ["af-ZA", "id-ID", "ms-MY", "ca-ES", "cs-CZ", "da-DK", "de-DE", "en-AU", "en-CA",
  "en-001", "en-IN", "en-IE", "en-NZ", "en-PH", "en-ZA", "en-GB", "en-US", "es-AR",
  "es-BO", "es-CL", "es-CO", "es-CR", "es-EC", "es-US", "es-SV", "es-ES", "es-GT",
  "es-HN", "es-MX", "es-NI", "es-PA", "es-PY", "es-PE", "es-PR", "es-DO", "es-UY",
  "es-VE", "eu-ES", "fil-PH", "fr-FR", "gl-ES", "hr-HR", "zu-ZA", "is-IS", "it-IT",
  "lt-LT", "hu-HU", "nl-NL", "nb-NO", "pl-PL", "pt-BR", "pt-PT", "ro-RO", "sl-SI",
  "sk-SK", "fi-FI", "sv-SE", "vi-VN", "tr-TR", "el-GR", "bg-BG", "ru-RU", "sr-RS",
  "uk-UA", "he-IL", "ar-IL", "ar-JO", "ar-AE", "ar-BH", "ar-DZ", "ar-SA", "ar-KW",
  "ar-MA", "ar-TN", "ar-OM", "ar-PS", "ar-QA", "ar-LB", "ar-EG", "fa-IR", "hi-IN",
  "th-TH", "ko-KR", "cmn-Hans-CN", "cmn-Hans-HK", "cmn-Hant-TW", "yue-Hant-HK",

// getSupportedLanguages result on iOS:

let supportedLanguagesIOS =


  Function successCallback, Function errorCallback)

Result of success callback is a Boolean.


  Function successCallback, Function errorCallback)

This method requests access permission to system resources if it was not granted before.

Ionic Usage

import { SpeechRecognition } from '@ionic-native/speech-recognition';

constructor(private speechRecognition: SpeechRecognition) { }


// Check feature available
  .then((available: boolean) => console.log(available))

// Start the recognition process
    (matches: Array<string>) => console.log(matches),
    (onerror) => console.log('error:', onerror)

// Stop the recognition process (iOS only)

// Get the list of supported languages
    (languages: Array<string>) => console.log(languages),
    (error) => console.log(error)

// Check permission
  .then((hasPermission: boolean) => console.log(hasPermission))

// Request permissions
    () => console.log('Granted'),
    () => console.log('Denied')

Required: ionic-native/speech-recognition

See Ionic Native documentation.

Android Quirks


  • cordova-android v5.0.0
  • Android API level 14
  • <android:launchMode> must not be singleInstance. It can be singleTask, standard, singleTop.
  • RECORD_AUDIO permission

How it works

It uses Speech API of Google. The Android public API recognizes when the speech is over and automatically begins the parsing process. The delay of result depends on the network quality.

Further readings

iOS Quirks


How it works

The Speech APIs perform speech recognition by communicating with Apple's servers or using an on-device speech recognizer, if available.

Because your app may need to connect to the servers to perform recognition, it's essential that you respect the privacy of your users and treat their utterances as sensitive data. For this reason, you must get the user's explicit permission before you initiate speech recognition.

The plugin works in AVAudioSessionCategoryPlayAndRecord mode to enable playing audio.

Further readings


Peter Bakondy


cordova-plugin-speechrecognition is licensed under the MIT Open Source license. For more information, see the LICENSE file in this repository.