I need your help. I'm writing application where I use SQLite database.
My problem is that I can't open database on Android side. I need read
and write permissions.
1. I tried assets like in tutorial but it doesn't work for me.
2. I did something like this:
"# Add more folders to ship with the application, here
QMLfiles.source = qml/roja
QMLfiles.target = qml
ContentFiles.source = content/roja
ContentFiles.target = content
DEPLOYMENTFOLDERS += QMLfiles \
ContentFiles"
and
2a. QFile file("content/roja/RojaDatabase.sqlite.db");
qDebug() << file.exists();
shows that file exists.
2b.
rojaDatabase = QSqlDatabase::addDatabase("QSQLITE");
rojaDatabase.setDatabaseName("content/roja/RojaDatabase.db.sqlite");
rojaDatabase.open();
qDebug() << rojaDatabase.lastError().text();
shows:
"unable to open database file Error opening database".
3. I tried copy my database to /data/data/MYAPP/files but still nothing.
I really doesn't have any idea how make it run :/ Please help.
Thanks in advance and best regards.
--
Maciej Płaza.
Thanks for fast answer. Your solution (from QtComplex) works excellent
on Android (I didn't tested it on other systems) but I have one
question. What when somebody wouldn't have SDCARD? Is there some way
to keep this file on internal storage?
Best regards.
--
Maciej Płaza.