Google Vision Api Text Recognizer Is Not Working
Solution 1:
The isOperational method from [TextRecognizer] (https://developers.google.com/android/reference/com/google/android/gms/vision/text/TextRecognizer) is inherited from Detector class. The method doesn't immediately returns true after setting up.
From the docs
"Indicates whether the detector has all of the required dependencies available locally in order to do detection.
When an app is first installed, it may be necessary to download required files. If this returns false, those files are not yet available. Usually this download is taken care of at application install time, but this is not guaranteed. In some cases the download may have been delayed."
Basically, if it's returning false, code it to wait and retry. I assume you are running tests on a phone, you will need to give it some time to download all the required libraries before that method will return true.
Solution 2:
you have to add this to your AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="ocr"/>
Post a Comment for "Google Vision Api Text Recognizer Is Not Working"