Can somebody give the steps to create Ionic 3 app with SQLite database targeting windows platform?
I want to create an offline windows application using ionic 3, SQLite as database.
I am using cordova-sqlite-storage plugin it is throwing an error saying could not open database.
If someone can help me the steps i need to follow that would be great. I trying to build for Win 8.1 pro OS.
Thank You
Hello,
I also could not install native sqlite plugin to browser.I fixed this problem like this.
import {SQLite, SQLiteObject} from "@ionic-native/sqlite";
declare let window: any;
constructor(private platform: Platform
private sqlite: SQLite)
async transaction(): Promise<any> {
let tx: SQLiteObject;
if (this.platform.is("browser") || this.platform.is("core") || this.platform.is("mobileweb")) /* Mobile screen in desktop*/
//if (this.platform.is("browser") || this.platform.is("core")) /* For Browser*/
return new Promise((resolve, reject) => {
let tx = window.openDatabase("MyDatabase", "1", "SOS DB", 1000000);
resolve(tx);
});
else { /*Native Devices*/
await this.sqlite.create({name: "MyDatabase.db", location: "default"})
.then((db: SQLiteObject) => tx = db)
.catch(e => console.log(e));
return new Promise<any>(res => res(tx));
}
}
}
1 Like