In my application I have an existing SQLite database attached. On start it's copied to phone and then being used. I know how to check if this database is already copied, but I want to check if database on the phone is the same as stored in APK. Is there any way to compare them? I want to do that programmatically.
Original database is stored in assets folder.
assetsfolder in my APK, and copied is in/data/data/my.package/databases/.context.getAssets().open("assert_db").available();andnew File("/data/...").length();for the actually db.availablesometimes has some problem, so you can read full content to memory, you can get the bytes size, or you can save the size withhardcode. maybe the hardcode is not a good idea, it depend on your requirement.