Hi,
I just downloaded and ran ocr-complete project in my device which is android 4.4( below api level 21) and it crashed due to an issue which is because on detection of text, according to code text will be converted to speech but tts(texttospeech) doesn't work below api level 21. So instead of directly converting text to speech, we can avoid the crash if we can check the sdk version of the device in which app is being run.
By this we can show the detected text on user tap by toast message on devices below android 5.0 and for android devices having android lollipop and above, the detected text can be converted to speech.
Please let me know your views on this suggestion.
Thanks.
Hi, I just downloaded and ran ocr-complete project in my device which is android 4.4( below api level 21) and it crashed due to an issue which is because on detection of text, according to code text will be converted to speech but tts(texttospeech) doesn't work below api level 21. So instead of directly converting text to speech, we can avoid the crash if we can check the sdk version of the device in which app is being run.
So according to this file :- https://github.com/googlesamples/android-vision/blob/master/visionSamples/ocr-codelab/ocr-reader-complete/app/src/main/java/com/google/android/gms/samples/vision/ocrreader/OcrCaptureActivity.java
On line number 351 , in onTap function, we have :-
tts.speak(text.getValue(), TextToSpeech.QUEUE_ADD, null, "DEFAULT");
we can change it to
By this we can show the detected text on user tap by toast message on devices below android 5.0 and for android devices having android lollipop and above, the detected text can be converted to speech.
Please let me know your views on this suggestion. Thanks.