Android - Access readonly sqlite database from assets

1.5k Views Asked by At

I would like to port one of my iOS apps to Android. In order to easily maintain the content of the app on both platforms the app will be shipped with its primary content stored in a sqllite database. I do not want to write to this database, only read.

Question: How do I open a sqllite database directly in readonly mode without needing to copy it out of the Assets folder?

I'm sorry if there is a very simple solution to this, but I'm still very new to Android development. I've searched for a solution where I won't have to copy the database from the Assets folder (like in this tutorial) every time i release an update of the app. So far I've had no luck in finding a solution to this.

Thanks in advance! :)

Nikolaj

1

There are 1 best solutions below

0
On

I was looking for a similar solution, but it appears that you cannot access it from within the app. The file needs to be copied to the device, even for readonly access. See this answer:

Open sqlite in readonly directly from assets