Dear Xp Pen,
Please find the way I proceeded to deploy and use the resources from the sdcard (in my case, I used the ko_KR language).
First, deploy the resources and conf file in the sdcard:
-Create the /sdcard/MyScript/assets/ directory
-from the latter, create a "conf", directory
-adb push the ko_KR.conf file in the latter
-from the /sdcard/MyScript/assets/ directory, create the resources/mul directory
-adb push the mul-lk-english_secondary_2.res file in the latter
-from the /sdcard/MyScript/assets/ directory, create the resources/ko_KR directory
-adb push the ko_KR-ak-cur.res and ko_KR-lk-text.res resources in the latter
In your project:
-In the AndroidManifest.xml file, add the read and write external storage permissions:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
In your code, set the confDir and ko_KR language:
String confDir = "/sdcard/MyScript/assets/conf"; conf.setStringArray("configuration-manager.search-path", new String[]{confDir}); String tempDir = getFilesDir().getPath() + File.separator + "tmp"; conf.setString("content-package.temp-folder", tempDir); conf.setString("lang", "ko_KR");
Start your application:
-In the logcat, you shoul have an error message indicating it is not able to load the ko_KR.conf file ; the reason is your application doesn't have the "File and Media access"
-To solve this, go to "Settings-> Apps & notifications" and select your app (e.g. iink GetStarted)
-Open the "Permissions"
-Allow "Files and media"
You shall now be able to load and use the ko_KR language.
Let us know if you have any question.
Best regards,
Olivier
xp pen
Hello, there is a scenario where I don’t want to use recognition resources (in Assets) inside the app.
I tried several methods and checked the corresponding documents, but the words were rather vague.
How should I configure the identified resource path to make the identified SDK work properly?
try code:
//...
engine = IInkApplication.getEngine();
String path = "/storage/emulated/0/recognition-assets/conf/en_US.conf";
// String path = "/storage/emulated/0/myscript-iink-recognition-text-en_US.zip";
File file = new File(path);
// log
LogConMgrUtil.getInstance().e("file exists : "+file.exists());
// configure recognition
Configuration conf = engine.getConfiguration();
String confDir = "zip://" + getPackageCodePath() + "!/assets/conf";
path = "zip://" + path + "!/assets/conf";
conf.setStringArray("configuration-manager.search-path", new String[]{path});
String tempDir = getExternalFilesDir(null).getPath() + File.separator + "tmp";
conf.setString("content-package.temp-folder", tempDir);
LogConMgrUtil.getInstance().e("confDir : "+confDir);
setContentView(R.layout.activity_main);
//...