Reputation: 1033
I'm using this library "com.google.android.gms:play-services-mlkit-text-recognition" in my Android project. I'm using this library for text recognition. It is working really well.
Problem is my application should'nt try to reach outside. At first application launch, Ml-kit tries to download trained model and if It can't download it fails to detect any text.
I want to download precompiled trained model and include that to my project at compile time so when a user download and run my application it won't try to connect google ml kit server.
How can I do this?
Upvotes: 0
Views: 885
Reputation: 524
ML Kit's Text Recognition API is backed by Google Play Service with an optional module that is typically downloaded and installed on demand. There is no version of the library that you can statically link.
However, you can configure your app to automatically download the module to the device after your app is installed from the Play Store. To do so, add the following declaration to your app's AndroidManifest.xml file:
<application ...>
...
<meta-data
android:name="com.google.mlkit.vision.DEPENDENCIES"
android:value="ocr" />
<!-- To use multiple models: android:value="ocr,model2,model3" -->
</application>
If you do not enable install-time model downloads, the model will be downloaded the first time you run the on-device detector.
Upvotes: 2