3

In all Android versions prior to 4.3, the name of Google's text-to-speech service, belonging to package android.tts.TtsService, is GoogleTTSService.

Thus, if you inspect the list of running services in devices running Android 4.2 or lower, you will find com.google.android.tts.GoogleTTSService among them.

But in Android 4.3 that seems to have changed and, among the many services listed in my running device, I can no longer find a corresponding service name.

What is the new name? Is it part of a different service?

Update: It appears that the package name for the service has been renamed from android.tts.TtsService in 2.x to android.speech.tts.TextToSpeech in 4.3. That's a step in the right direction but the actual name of Google's engine is still missing.

Any idea?

ttsfan
  • 31
  • 2
  • possible duplicate of [How to find the package name of the TTS service in Android 4.3?](http://stackoverflow.com/questions/19192252/how-to-find-the-package-name-of-the-tts-service-in-android-4-3) – CommonsWare Oct 06 '13 at 18:25

2 Answers2

1

You can discover the package for any TTS Engine in the following way:

TextToSpeech tts = new TextToSpeech(context, onInitListener);

Then in the onInit Listener:

        @Override
        public void onInit(final int status) {

            switch (status) {

            case TextToSpeech.SUCCESS:

                try {

                    final String initEngine = tts.getDefaultEngine();

    // Output the engine to the log if it's != null

                } catch (final Exception e) {

                }

        break;
    }
}

From my experience, the engine can sometimes return null or crash when it's called too soon after onInit, so surrounding with a try/catch block is recommended. This was only happening with some IVONA and SVOX TTS engines, but of course the user could have one of those as their default.

brandall
  • 6,094
  • 4
  • 49
  • 103
1

According to this, you may be using the ACTION_CHECK_TTS_DATA intent, which is not handled correctly in Android 4.2.

Try to eliminate the use ACTION_CHECK_TTS_DATA intent and instead we just rely on the method TextToSpeech.isLanguageAvailable() as an indicator of whether or not the voice data is installed.

Additional useful information that may be related to your problem:

Community
  • 1
  • 1
sfinja
  • 400
  • 4
  • 11