Last active
September 4, 2016 11:49
-
-
Save mateuszbaluch/bd611849f7eae1a43eb7c8798b492245 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public void onVoiceActivation(View view) { | |
| Intent recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); | |
| recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "pl_PL"); | |
| recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, view.getContext().getPackageName()); | |
| recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH); | |
| recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3); | |
| this.speech.startListening(recognizerIntent); | |
| final Handler handler = new Handler(); | |
| handler.postDelayed(new Runnable() { | |
| @Override | |
| public void run() { | |
| this.speech.stopListening(); | |
| } | |
| }, 5000); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment