Has anybody tried using this on Android with a static DB resource?

Aug 9, 2014 at 4:07 AM
I want to ship a DB with my app. I will never need to write to it; it will be used for reads only. The problem I am having is finding a path that I can put into
ISQLiteConnection = new SQLiteConnection(somePath).
I can put my DB into my project anywhere I like. But the Android Assets system does not appear to be path friendly. Posted solutions suggest copying the db http://stackoverflow.com/questions/9109438/how-to-use-an-existing-database-with-an-android-application?lq=1, which seems like it ought to be unnecessary for a static DB.
Aug 21, 2014 at 8:33 PM
Hi @verybadcat,

I've found that in Android you can refer to assets or resources by using the URIs 'file:///android_asset/<asset-name>' or 'file:///android_res/<resource-path>/<resource-name>'. Unfortunately, even after enabling URI filenames on Sqlite (it's disabled with current release), I couldn't use this URIs to refer to static content. I did try using a URI to internal storage, something like 'file:///data/data/app.package.name/<database-name>' and it did work (with URI enabled).

I believe you will need to follow the suggestion you linked, by copying your static content into internal storage and referencing it from there.

Marked as answer by leotilli on 9/5/2014 at 11:26 AM