简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM