Guest User

Untitled

a guest
Jan 19th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
  2. intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
  3. RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
  4. intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
  5. "com.domain.app");
  6. intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
  7. Intent.putExtra(/*Add more stuff that I want*/);
  8.  
  9. RecognitionListener listener = new RecognitionListener() {
  10. @Override
  11. public void onPartialResults(Bundle results) {
  12. //What am I supposed to get when I do get PartialResults????
  13. }
  14. @Override
  15. public void onResults(Bundle results) {
  16. }
  17.  
  18. @Override
  19. public void onReadyForSpeech(Bundle params) {
  20. }
  21.  
  22. @Override
  23. public void onError(int error) {
  24. }
  25.  
  26. @Override
  27. public void onBeginningOfSpeech() {
  28. }
  29. };
  30.  
  31. SpeechRecognizer recognizer = SpeechRecognizer
  32. .createSpeechRecognizer(this.getApplicationContext());
  33.  
  34. recognizer.setRecognitionListener(listener);
  35. recognizer.startListening(intent);
Add Comment
Please, Sign In to add comment