I'm new to ionic app development.
Going to develop a dictionary app with ionic, angular and sqlite.
SQLite db file is already prepared with required tables and the app needs to be deployed with the db file.
As the first step how can I read data from db file?
Should I use
SQLite https://ionicframework.com/docs/native/sqlite
or
SQLite Porter https://ionicframework.com/docs/native/sqlite-porter
let db = (<any>window).openDatabase('dictionary', '1.0', 'dictionary', 1 * 1024);
this.http.get('../assets/database/dictionary.db', { responseType: 'text' })
.subscribe(sql => {
this.sqlitePorter.importSqlToDb(db, 'select * from terms')
.then(() => console.log('Imported'))
.catch(e => console.error(e));
}, error => {
console.log('error: ' + JSON.stringify(error));
});
I tried above coding but it gives me 404 not found error on Android Studio emulator.