I have a code to check the TTS engine availability in the device. As the statement tts.getEngines().size() < 1 will be executed only from the API 14. I need to know if there is any way(methods) to check the same functionality even from the API 8.
Thanks in Advance
Code:
private void checkTTSAvailability() {
tts = new TextToSpeech(this, this);
ttsPresent=true;
**if (tts.getEngines().size() < 1) {**
PackageManager pm = getPackageManager();
Intent installIntent = new Intent();
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
ResolveInfo resolveInfo = pm.resolveActivity(installIntent, PackageManager.MATCH_DEFAULT_ONLY);
if (resolveInfo == null) {
Log.i("DragDrop", "No voice support on your phone");
Dialog d = new Dialog(this);
d.setTitle("Alert ");
TextView tv = new TextView(this);
tv.setText("No voice support on your phone");
d.setContentView(tv);
d.show();
ttsPresent=false;
// Not able to find the activity which should be started for
// this intent
} else {
Dialog d = new Dialog(this);
d.setTitle("Alert ");
TextView tv = new TextView(this);
tv.setText("Installing");
d.setContentView(tv);
d.show();
Log.i("DragDrop", "Installing");
startActivity(installIntent);
}
}
}