Closed tuanbs closed 7 years ago
Hi, Stil having the same issue? What version of ionic do you have?
I use Ionic v2, the latest one. Anyway, I solved it by using the sqlite-ext. Thanks.
Yes you were supposed to use sqlite-ext plugin, otherwise it won't work. Any question ask away ;)
I mean I have to use the syntax of sqlite-ext to load the pre-populated DB: `declare var cordova: any; declare var window: any;
db = window.sqlitePlugin.openDatabase( { name: 'dbName.db', location: 'default', createFromLocation: 1 } ); ` Then it'll copy the pre-populated DB. Using the code in your repo will generate the empty DB:
import { SQLite } from 'ionic-native'; ... public storage: SQLite; ... private options = { name: "data.db", location: 'default', createFromLocation: 1 }; ... this.storage.openDatabase(this.options).then((success) => {...})
As far as I known this is an issue of ionic-native. Anyway, I tested it and found DB is empty and I don't know how you can get pre-populated DB using your code.
Cheers.
@tuanbs Are you using an emulator or physical device? When i have some time i'll look at my code again to update it to the last Ionic 2 version.
@tuanbs
I updated to the new version of ionic and with this i will keep most of my code. With some minor changes.
I'll update the repo today.
Updated version now available. Anything let me know.
Hi I followed your code but when I opened DB, it is empty. How can I solve it? Thanks.