Sqlite and ionic view


I’m using the following to start an sqlite db in my app.

if (window.sqlitePlugin !== undefined) {
_db = window.sqlitePlugin.openDatabase({
name: “tim.db”,
location: 2,
createFromLocation: 1
} else {
// For debugging in the browser
_db = window.openDatabase(“tim.db”, “1.0”, “tim”, 200000);

This appears to work fine, I can test in the browser and in ionic view.

However, after using the app for some time in ionic view the database appears to empty.

I added alerts to identify which of the above was called in ionic view, it appears that the second is being used. I can only assume the max size has been reached.

Is the DB deleted when max size is reached in this way?

Also is there a reason the DB used the second function rather than the sqlitePlugin?

is there anyway of recovering the data lost?

Thanks for any help.

ok, a little further investigation.

I added alerts to identify which of the above was called. And ran the app on an android device directly, ie not in ionic view, and the second debug version was called. so it seems the sqlite plugin is not being called, why is this?