RecognitionListener Samsung Galaxy Watch 4

Hi
I faced with issue on samsung watch 4 with speech listener.

Listener Service

class SpeechListener : LifecycleService(), RecognitionListener {
private lateinit var speechRecognizer: SpeechRecognizer

        override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
              
                speechRecognizer = SpeechRecognizer.createSpeechRecognizer(this,         ComponentName.unflattenFromString("com.google.android.googlequicksearchbox/com.google.android.voicesearch.serviceapi.GoogleRecognitionService")
                )
                speechRecognizer = SpeechRecognizer.createOnDeviceSpeechRecognizer(this)
                speechRecognizer.setRecognitionListener(this)
        
                val voice = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
                voice.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault())
                voice.putExtra(
                    RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                    RecognizerIntent.LANGUAGE_MODEL_FREE_FORM
                )
                voice.putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true)
        
                speechRecognizer.startListening(voice)
        
                startForeground(this)
        
                return super.onStartCommand(intent, flags, startId)
            }

override fun onResults(results: Bundle?) {
        val matches = results?.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)
        Log.i(">>>>>>>>> SPOKEN TEXT ", matches!![0])
        
            }

}

Main Activity

class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
    val navController = findNavController(R.id.nav_host_fragment_content_main)

    val speechIntent = Intent(this, SpeechListener::class.java)
    startForegroundService(speechIntent)
}

}

AndroidManifest.xml

queries
package android:name=“com.google.android.googlequicksearchbox”/
intent
action android:name=“android.speech.RecognitionService” /
/intent
/queries

I get error: E/SpeechRecognizer: no selected voice recognition service

Some suggestions, please)

Galaxy Watch 4 is an Wear OS powered by Samsung device and the documentation for it is on the Android site.

A lot of libraries need to be updated to the latest androidx that may be an issue but that is just a guess.

Ron
Samsung Developer Relations

1 Like

I updated all androidx dependencies, but it doesn’t help(
Maybe some workaround flow?

Do you know if this is just with Galaxy Watch4 of is it with other watches using Wear OS Powered by Samsung (API 28 or newer also known as Wear OS 3).

If it is just Watch4 then maybe we can help but if it is with all the newer Wear OS watches Then that is not a Samsung issue.

Ron
Samsung Developer Relations

Thank you Ron for answering)
How can I install older Wear OS on Galaxy Watch 4 ?

Galaxy Watch4 runs Wear OS powered by Samsung and that is Wear OS API 28 and newer. which is also called Wear OS 3 by many users.

Ron
Samsung Developer Relations.