I want to share one sqlite db from headless and main app on Blackberry 10 OS. On the main app, I setup the db like this
QString dataFolder = QDir::homePath();
QString newFileName = dataFolder + "/myapp.db";
QFile newFile(newFileName);
if (!newFile.exists()) {
// If the file is not already in the data folder, we copy
// it from the assets folder (read-only) to the data folder
// (read-write)
QString appFolder(QDir::homePath());
appFolder.chop(4);
QString originalFileName = appFolder + "app/native/assets/myapp.db";
QFile originalFile(originalFileName);
if (originalFile.exists()) {
retu originalFile.copy(newFileName);
} else {
qDebug() << "Failed to copy file, database file does not exist.";
retu false;
}
}
Then after that I execute to the db like this
SqlDataAccess sqlDataAccess("data/myapp.db");
sqlData = sqlDataAccess.execute(query)
The insert,update, delete process from the main app has been done successfully. Now I need to access the same db from the headless app, I did the same setup but with no luck. My guess the problem here is probably about the location of the db, but can't figure out.
Since there is not so much post about the development on BB 10 like the other OS (Android, iOS), I hope someone can help me on this. Thanks a lot!
