Closed kishorejethava closed 3 years ago
Hi @kishorejethava,
Thanks for your detailed report!
Unfortunately, yes, it works at the moment as you described. Could you please describe your use-case of why you want to run the initialization process later?
Because It's taking long time to download and initialization so we separated both, and does downloading setup at the time of first launch of app.
prepareDatabase
will download the database only once. It will be downloaded next time when it's removed from the app or it's incompatible with the SDK. So, even if you will invoke the prepareDatabase
each time when the app starts and it meets the conditions that I described, it won't be downloaded each time. Therefore, you can run the initialization process right after the prepareDatabase
finishes its work.
Also, you can add the database manually to the project if you don't want to download it via the Internet using the prepareDatabase
/ runAutoUpdate
: https://docs.regulaforensics.com/android/database#adding-database-manually.
We are checking that Database exist or not by following function and its working fine.
private fun isDatabaseExist(): Boolean {
val storagePath = File(getExternalFilesDir(null as String?), "Regula/db.dat")
val applicationPath = File(filesDir, "Regula/db.dat")
val atApplicationPath = applicationPath.exists()
val atStoragePath = storagePath.exists()
Timber.tag(SplashActivity::class.java.simpleName).d("atApplicationPath:${atApplicationPath} | atStoragePath:${atStoragePath}")
return if (atApplicationPath) {
true
} else atStoragePath
}
Use-case: I want just download database on launching app and want to initialisation reader process later on. Issue: Every time downloads database on relaunch app, after removing reading licence and initialisation reader code from sample code.
How to reproduce:
resources.openRawResource(R.raw.regula)
initializeReader
here is sample code