Class ShadowSpeechRecognizer

java.lang.Object
org.robolectric.shadows.ShadowSpeechRecognizer

@Implements(value=android.speech.SpeechRecognizer.class, looseSignatures=true) public class ShadowSpeechRecognizer extends Object
Robolectric shadow for SpeechRecognizer.
  • Field Details

    • latestSpeechRecognizer

      protected static SpeechRecognizer latestSpeechRecognizer
  • Constructor Details

    • ShadowSpeechRecognizer

      public ShadowSpeechRecognizer()
  • Method Details

    • getLatestSpeechRecognizer

      public static SpeechRecognizer getLatestSpeechRecognizer()
      Returns the latest SpeechRecognizer. This method can only be called after SpeechRecognizer.createSpeechRecognizer(Context) is called.
    • getLastRecognizerIntent

      public Intent getLastRecognizerIntent()
      Returns the argument passed to the last call to SpeechRecognizer.startListening(android.content.Intent).
    • isDestroyed

      public boolean isDestroyed()
      Returns true iff the destroy method of was invoked for the recognizer.
    • reset

      @Resetter public static void reset()
    • destroy

      @Implementation protected void destroy()
    • createSpeechRecognizer

      @Implementation protected static SpeechRecognizer createSpeechRecognizer(Context context, ComponentName serviceComponent)
    • startListening

      @Implementation protected void startListening(Intent recognizerIntent)
    • handleChangeListener

      @Implementation protected void handleChangeListener(RecognitionListener listener)
      Handles changing the listener and allows access to the internal listener to trigger events and sets the latest SpeechRecognizer.
    • triggerOnEndOfSpeech

      public void triggerOnEndOfSpeech()
    • triggerOnError

      public void triggerOnError(int error)
    • triggerOnReadyForSpeech

      public void triggerOnReadyForSpeech(Bundle bundle)
    • triggerOnPartialResults

      public void triggerOnPartialResults(Bundle bundle)
    • triggerOnResults

      public void triggerOnResults(Bundle bundle)
    • triggerOnRmsChanged

      public void triggerOnRmsChanged(float rmsdB)
    • createOnDeviceSpeechRecognizer

      @Implementation(minSdk=33) protected static SpeechRecognizer createOnDeviceSpeechRecognizer(Context context)
    • isOnDeviceRecognitionAvailable

      @Implementation(minSdk=33) protected static boolean isOnDeviceRecognitionAvailable(Context context)
    • checkRecognitionSupport

      @RequiresApi(api=33) @Implementation(minSdk=33) protected void checkRecognitionSupport(@NonNull Object recognizerIntent, @NonNull Object executor, @NonNull Object supportListener)
    • triggerModelDownload

      @Implementation(minSdk=33) protected void triggerModelDownload(Intent recognizerIntent)
    • setIsOnDeviceRecognitionAvailable

      public static void setIsOnDeviceRecognitionAvailable(boolean available)
    • triggerSupportResult

      @RequiresApi(33) public void triggerSupportResult(Object recognitionSupport)
    • triggerSupportError

      @RequiresApi(33) public void triggerSupportError(int error)
    • getLatestModelDownloadIntent

      @RequiresApi(33) @Nullable public Intent getLatestModelDownloadIntent()