Text to Speech not working in Android 4.2 Jelly Bean - android

We added voice prompts to our app using the Text to Speech API a couple years ago and it has been working well. Recently, we started receiving email from users that upgraded to Android 4.2 Jelly Bean saying that voice prompts are not working and that they are getting a message that the voice data is missing and they need to download it. When they click to download they are given the option of downloading languages other than English.
We implemented text to speech following this post on the Android Developer's Blog. We are invoking the TextToSpeech.Engine.ACTION_CHECK_TTS_DATA intent and if anything other than TextToSpeech.Engine.CHECK_VOICE_DATA_PASS is returned we invoke the TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA intent.
We don't have access to a device running 4.2. I went into a local store today and downloaded the app on a Nexus 7 tablet with 4.2 installed and was able to reproduce the problem. However, when we create an AVD based on the Nexus 7 and run the emulator the voice prompts work fine and we are not able to reproduce the issue.

TTS checking with Android OS4.1 and OS 4.2 is, being polite, different.
OS 4.1 does not correctly handle the intent to install data*
TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA
OS 4.2 does not correctly handle the intent to check for voice data*
TextToSpeech.Engine.ACTION_CHECK_TTS_DATA
* By this I mean that it doesn't return the correct status codes as per the old versions. For example, CHECK_TTS_DATA returns CHECK_VOICE_DATA_MISSING_DATA when it clearly does have voice data installed. It's possible that there is some other intent data that now needs to be passed, but I'm not sure where this is documented.
In my apps I have had to disable these checks for newer OS versions. I suspect Google may have done this because their terms to use Android now mandate TTS (but I can't verify this - I'm sure there's a site out there that describes exactly what must be implemented to be called 'Android')
Update
As I suspected, Android OS 4.1 now mandates Text-to-Speech be included in every Android device, thus the checks are now somewhat redundant. From this link: Android 4.1 Compatibility Definition
3.11 Text-to-Speech
Android 4.1 includes APIs that allow applications to make use of text-to-speech (TTS) services, and allows service providers to provide implementations of TTS services [Resources, 32]. Device implementations MUST meet these requirements related to the Android TTS framework:
Device implementations MUST support the Android TTS framework APIs and SHOULD include a TTS engine supporting the languages available on the device. Note that the upstream Android open source software includes a full-featured TTS engine implementation.
Device implementations MUST support installation of third-party TTS engines.
Device implementations MUST provide a user-accessible interface that allows users to select a TTS engine for use at the system level.

Related

Any way to access SpeechSynthesis inaccessible on Kindle Fire?

I release an app for people with disabilities to help them speak when they can't use their voice. I use android.speech.tts.TextToSpeech to generate speech in my app Android (Google and also Amazon), but it looks like Amazon is now blocking access to the speech synthesis engine in its latest version of FireOS (testing on a Kindle Fire 7 2022).
android.speech.tts.TextToSpeech => getVoices
now returns an empty list, where it didn't with prior versions of FireOS. I'd have given up completely, but the eSpeak app (com.reecedunn.espeak) when side-loaded shows the default OS engine ("English (United States.salli)") and can synthesize speech. That app hasn't been updated since 2015 so maybe it's just a legacy quirk, but since Amazon also doesn't seem to allow third-party TTS engines in their AppStore, I'm hitting a bit of a wall and looking for anything. The workaround is to use eSpeak, which is not nearly as good at the voices Amazon already has installed on the device. Has anyone else run into this, or have ideas what to try?

Examples of forward incompatibility of the Android framework

For a report on Android fragmentation, I am researching about forward compatibility of the Android framework/SDK.
It is widely stated, that the Android SDK is forward compatible, meaning, that applications developed with one framework will run on devices, that are running a later one, i.e. on Forward or Backward Compatibility in Android?. When a feature or API is deprecated it is mostly stated on developer.android.com, that the feature will continue to work on devices, i.e. Google Maps Android v1.
Now, I experienced myself a case of incompatibility with Text-to-speech, when running a 2.2 application on to 4.1. This case is portrait here Text to Speech not working in Android 4.2 Jelly Bean. (Shortly, you are not supposed to check for the availability of TTS before using it anymore, because the existence of TTS on a device is mandatory from 4.1 onwards. And in fact, this check will falsely return false on 4.1, so your code that was written for on 2.x is not working properly on 4.1 onwards.)
Are there any other examples when an App or one of its functionalities stop working on a later version (apart from Apps developed for 1.x)? What are the specific deprecated features/APIs that make troubles on newer devices?

Should Text-To-Speech engine existence be checked on newer android platforms?

In Android Froyo-api8 till Gingerbread api-10, the Text-To-Speech was not always installed on the system. I heard some time ago that from a certain API onwards, TTS will be an integral part of Android.
I want to prevent TTS availability checks in the code running on new platforms. Does anyone have any experience with this?
Is there any official documentation regarding the Text-To-Speech engine that says it will be available on certain platforms?
Just to elaborate I use this code to check TTS existance.
final Intent checkIntent = new Intent();
checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
sourceActivity.startActivityForResult(checkIntent, TTS_CHECK_REQ);
in the onActicityResult I match resultcode with CHECK_VOICE_DATA_PASS to consider success else failure.
From the Android Developer's Blog:
Although all Android-powered devices that support the TTS functionality ship with the engine, some devices have limited storage and may lack the language-specific resource files. If a user wants to install those resources, the TTS API enables an application to query the platform for the availability of language files and can initiate their download and installation. So upon creating your activity, a good first step is to check for the presence of the TTS resources with the corresponding intent: (your example intent follows)
What I get out of this is that the engine is a core part of the platform. However, the voice data isn't, and that's what your intent is actually checking for. I wouldn't disable this check, though, because not all devices are guaranteed to have the data installed when they ship.
Sure, the latest Galaxy or Nexus will, but what about the cheaper phones? What about the real cheap ones? They might be running ICS or JB, but the manufacturer may have skimped, or was just trying to save disk space. What about custom ROMs? There are some that pride themselves on stripping out Android's "bloat". I can almost guarantee that at least one removes the voice data.

Which Android Version Introduced SpeechRecognizer's Audible Cue onReadyForSpeech?

Android 2.x does not automatically sound an audible cue when ready for speech input.
Android 4.1 does.
What happens in between these versions? i.e. When was this cool feature introduced?
Android 3.0? (Build.VERSION_CODES.HONEYCOMB_MR)
Android 3.1? (Build.VERSION_CODES.HONEYCOMB_MR1)
Android 3.2? (Build.VERSION_CODES.HONEYCOMB_MR2)
Android 4.0? (Build.VERSION_CODES.ICE_CREAM_SANDWICH)
I need this in order to perform a check against Build.VERSION.SDK_INT at runtime.
Do you know of any source that documents this?
That "ready for speech" double-beep to which you are referring is not a feature of the Android OS but rather Google App.
This is very close to Kaarel's answer but the distinction between Voice Search and Google App could be confusing.
What's more confusing is the fact that Google App used to be named Google Search but make no mistake: The identical package name turns itself in... com.google.android.googlequicksearchbox.
I don't know exactly at what point the "no beep Google Search" turned into "cool double-beep Google App", but my limited observation shows that Google Search version 1.3.3 (Android 2.2.1) had no beeps, while Google App version 4.1.24 (Android 4.1.2) has those beeps.
As of today (2015-01-22), Version 1.3.3.247963 of Google Search is latest version available on Google Play for Android 2.2.1 devices.
An Android 4.1.2 device, however, can see a higher version in Google Play and download & install it: 4.1.24.1672412.arm.
Thus, it seems that those beeps are tied to the Android version.
BTW, Google App features what's known as "OK Google". Perhaps that was the reason for introducing those (now famous) beeps.
"OK Google" was first introduced in the Google I/O conference in May 2013, but since it is available for download from Google Play to Android 4.1 devices (which was introduced in July 2012), one cannot assume direct link to the latest release version at that time. There are, in fact, instructions on how to install Google App on Android 4.0 but I doubt that is supported by Google. Thus, to be safe, I would say that if you enabled automatic updates on your smartphone, then the Android version that first introduced "the recognizer beeps" is 4.1.
This might be a feature of Google Voice Search, but Google Voice Search is a regular app and thus external to Android.
onReadyForSpeech is a callback via which an end-user app (e.g. a keyboard app) can have some code executed by the speech recognizer app (e.g. Google Voice Search). Both of these apps can sound the audible cue but neither is part of the core Android.
Maybe relevant:
void startRecording (MediaSyncEvent syncEvent)
was added in API level 16.

Android TtsService.apk?

Wikipedia:Version 1.6 of Android added support for speech synthesis (TTS).
But my question is "Does any Android device has TtsService.apk"?
Android 1.6+ has a built-in TTS service on every device (short of, maybe, some extreme customizations). For extended TTS services - i. e. the ability to use plug-in third party engines - one has to download the free "TTS Services Extended" app from the Market.
On Android 2.2 and above - the majority of the current installed base - the extended TTS service is baked in.
The specific APK name is irrelevant, it's an implementation detail.
EDIT:
1 . Quoting http://developer.android.com/resources/articles/tts.html :
Starting with Android 1.6 (API Level 4), the Android platform includes a new Text-to-Speech (TTS) capability.
2 . What do you mean by "TTS (files)"? The standard engine on Android 1.5 and below? The extended TTS service? Some third party engine? Your own engine?

Categories

Resources