0

Actually I am new to Leanback and I am working in the search part and implement SearchFragment. I am facing this issue on error log message (when run on device, but working on android virtual device):

Caused by: java.lang.IllegalArgumentException: Service not registered: android.speech.SpeechRecognizer$Connection@f545b3e

If any one knows please update. Thank you.

Tomero Indonesia
  • 1,685
  • 2
  • 16
  • 17

1 Answers1

0

It may not be relevant anymore, but I myself did something like:

override fun onResume() {
        super.onResume()

        try {
            if (!Utils.isATV(requireContext())) {
                val mSpeechRecognizerField: Field = SearchSupportFragment::class.java.getDeclaredField("mSpeechRecognizer")
                mSpeechRecognizerField.isAccessible = true
                mSpeechRecognizerField.set(this, null)
            }
        } catch (e: Exception) {
            Log.e("", "Method not found")
        }

    }

Conditions and checks can be done at your discretion. I have voice search on Google's AndroidTV (leanback), but on other devices it is turned off.

You can check for the presence of the service itself in the system.

V. Denis
  • 1
  • 2