0

I need to install Polish language if missing, but on Samsung device both Samsung TTS and Google TTS is showing up as intent handler. How can I make it for Google TTS to show up only?

Code:

    tts = TextToSpeech(
        applicationContext
    ) { status ->
        if (status != TextToSpeech.ERROR) { 
            // Check if the Polish language is available
            val result = tts!!.setLanguage( Locale("pl")) 

                        // The Polish language is not available, prompt the user to install it
                        val installIntent = Intent()
                        installIntent.action = TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA
                        startActivity(installIntent)

        }
    }

enter image description here

And also is it possible to install this without asking to user via intent? As far as I know user must click on the prompt, but I heard some apps can use Polish language without installing missing Polish language data. Such as 'EWA'. Can this be true?

Rifat
  • 1,700
  • 3
  • 20
  • 51
  • may be you can try specify the google tts package name. installIntent.data = Uri.parse("package:com.google.android.tts") – Dev007 Apr 20 '23 at 07:30
  • @Dev007 crashes, No Activity found to handle Intent { act=android.speech.tts.engine.INSTALL_TTS_DATA dat=package: } – Rifat Apr 20 '23 at 08:41

0 Answers0