SQLite - problem

Here an sqlite database created in DB Browser and loaded to assets. app running in Companion:

image

Try this.

Sorry need to attach the db file/s. You will need to remove the .txt file extension.

testbrow.db.txt (12 KB)

Hello.
Thanks for help.
And how did you do ImportDatabase?
It falls to me at this point.
The DatabaseExist statement ends with FALSE
Ondrej

I showed you in the blocks: when running companion...the database is in the assets, then open the database using the full path. The path will be different if you have Android version 9 or less and different again if using a compiled app.

Please advise on your test environment. You mentioned you were using Android 6 device earlier, is this when running the latest companion app in development mode ?

Getting database path which is uploaded in media as asset is a little bit tricky. I found following solution from a thread of Juan Antonio.

That may well only work in companion....in later versions of Android....

You should be able to use the double slash for both companion and compiled to import:

image

You do not want to "open" a database from assets, as the file will be read only.

1 Like