Created
August 25, 2018 15:00
-
-
Save dev-aritra/826b77d11f29b4ae5c80e5e7b9cf3316 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void StartRecordingAndRecognizing() | |
{ | |
string rec = global::Android.Content.PM.PackageManager.FeatureMicrophone; | |
if (rec == "android.hardware.microphone") | |
{ | |
var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech); | |
voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm); | |
voiceIntent.PutExtra(RecognizerIntent.ExtraPrompt, "Speak now"); | |
voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1500); | |
voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500); | |
voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000); | |
voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1); | |
voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default); | |
_activity.StartActivityForResult(voiceIntent, VOICE); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment