Skip to content

Commit

Permalink
fixed unusual bug where some android versions cannot initialize voice…
Browse files Browse the repository at this point in the history
… output
  • Loading branch information
dewall committed Jun 3, 2016
1 parent 0da80c6 commit 1660fd7
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,15 @@ public void onCreate() {
mTTS = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
mIsTTSAvailable = true;
mTTS.setLanguage(Locale.ENGLISH);
} else {
LOG.warn("TextToSpeech is not available.");
try {
if (status == TextToSpeech.SUCCESS) {
mTTS.setLanguage(Locale.ENGLISH);
mIsTTSAvailable = true;
} else {
LOG.warn("TextToSpeech is not available.");
}
} catch(IllegalArgumentException e){
LOG.warn("TextToSpeech is not available");
}
}
});
Expand Down

0 comments on commit 1660fd7

Please sign in to comment.