Skip to content

Instantly share code, notes, and snippets.

@catalinghita8
Last active July 6, 2020 17:01
Show Gist options
  • Save catalinghita8/90297552b770e10a0a93f4b7e61329e1 to your computer and use it in GitHub Desktop.
Save catalinghita8/90297552b770e10a0a93f4b7e61329e1 to your computer and use it in GitHub Desktop.
private fun promptSpeechInput() {
val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
intent.putExtra(
RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM
)
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, activity?.application?.packageName?: "")
speechRecognizer?.startListening(intent)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment