[JAVA] What to do if TextToSpeech doesn't work on Android 11

Introduction

Suddenly TextToSpeech stopped working on the Pixel 3 I'm using for development. It works normally on other development terminals such as Xperia. TextToSpeech's onInitListener returns status = -1

Cause and remedy

Cause: android 11 spec

Workaround: Add INTENT_ACTION_TTS_SERVICE to AndroidManifest.xml

It was officially written as follows.

Apps targeting Android 11 that use text-to-speech should declare TextToSpeech.Engine#INTENT_ACTION_TTS_SERVICE in the queries elements of their manifest:

If you add it to the manifest like the following, it will work.

AndroidManifest.xml


<manifest>
・ ・ ・
    <queries>
・ ・ ・
        <intent>
            <action android:name="android.intent.action.TTS_SERVICE" />
        </intent>
    </queries>
</manifest>

Recommended Posts

What to do if TextToSpeech doesn't work on Android 11
What to do if validation doesn't work with the update action
What to do if the rails server doesn't run out on AWS cloud9
What to do if audio is not available on discordrb
What to do if Android Studio says "your CPU doesn't support vt-x or svm"
What to do if the Rails page doesn't appear in Rails tutorial 1.3.2
What to do if you install Ubuntu
What to do if deployment fails on Heroku (Ruby app not detected)
no space left on device What to do if an error occurs
What to do if you get a MiniMagick vulnerability alert on GitHub
What to do if the server tomcat dies
What to do if you push incorrect information
What to do if mvn archetype: generate fails
What to do if you have installed Java for OS X on macOS
What to do if Docker Desktop fails to launch on your M1 MacBook Pro
What to do if you get an error on heroku rake db: migrate
What to do if build from command line fails in Android development environment
What to do if the debug gem installation fails
What to do if the Rails server can't start
What to do if you accidentally create a model
What to do if an ActionController :: UnknownFormat error occurs
What to see when IntelliJ doesn't start on Mac
What to do if password authentication fails in Docker/Postgres
What to do if you get a NoClassDefFoundError when trying to run eclipse on Java9
What to do if the JSONHint annotation does not work with lombok and JSONIC
What to do if you get a port error when docker-compose up on Mac
Simulator does not work: Unable to boot device due to insufficient system resources
Things to check when it doesn't work with proguard
What to do if TextToSpeech doesn't work on Android 11
What to do if FacesMessage is set but not displayed
# What to do if you accidentally do rails db: migrate: drop
What to do if the adb command cannot be executed
What to do if mysql2 gets a bundle install error
What to do if you can't use the rails command
What to do if you enable UFW on Ubuntu VM on GCP and you can't connect to SSH
What to do if a SAX Parser error occurs when using Liferay 7 / DXP on AWS
[Ubuntu 20.04] What to do if the external monitor is not recognized
How to "hollow" View on Android
Notes on what to do if Ubuntu 20.04 installation on Virtual box 6.1 (Windows10) fails with "Error 5 Input / output error"
[Rails] What to do if data is not registered in DB
What to do if Cloud9 is full in the Rails tutorial
What to do if the Eclipse Maven dependency Jar is wrong
What to do if you get a DISPLAY error in gym.render ()
What to do after Vagrant install
What to do if you get angry with OpenSSL with pyenv install
[Logback] What to do if unnecessary files do not disappear during rotation
What to do when javax.batch.operations.JobStartException occurs
What to do if you forget the root password in CentOS7
What to do if you cannot roll back the migration (UnknownMigrationVersionError)
[Rails] What to do if you can't get parameters with form_with
What to do if you get the error Too long with no output (exceeded 10m0s) on CircleCI
What to do if changes are not reflected after automatic deployment to EC2
What to do if you get a groovy warning in Thymeleaf Layout
Add gem'rails-i18n','~> 6.0.0' and what to do if bundle install gives an error
What to do if you get an error during rails db: reset
What to do if the prefix c is not bound in JSP
What to do when CentOS cannot be started with VirtualBox on Catalina
[Composer] [Laravel] What to do if you cannot install due to insufficient memory
What to do if you get an uninitialized constant Likes Controller error
What to do if you can't install the plugin from the Eclipse marketplace
What to do when Blocked Host: "host name" appears in Ruby on Rails
What to do if an error occurs when nokogiri enters when bundle install
What to do if you don't like the code generated by swagger-codegen-cli