Слушатель распознавания Samsung Galaxy Watch 4

Я столкнулся с проблемой на samsung watch 4 с прослушивателем речи.

Служба прослушивания

          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])
            
                }
}

Основная деятельность

      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>

Я получаю сообщение об ошибке:

      E/SpeechRecognizer: no selected voice recognition service

Несколько советов, пожалуйста)

0 ответов