You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a requirement to use a pre-populated sqlite database in an Ionic app but I have noticed that its not possible to include a db in the www directory any more as the files in www get deleted with every build.
The options are either you can have a custom config for your build or you can copy the db file into /src/assets folder which will then get copied into www/assets on build.
If you go with the 2nd option, this plugin will not create the database as it only tries to find the db inside the www directory not in the sub folders.
Below are the options I have used.
{name: 'sqlite.db', location: 'default', createFromLocation: 1}
With the option createFromLocation: 1, this can be fixed by appending "assets" to the "www" string inside createFromResource function.
on Android SQLitePlugin.Java ("www/assets/")
on iOS and SQLitePlugin.m ("www/assets")
With the above changes we can get the plugin to work correctly.
Are there any better solutions to this?
would it be better to update the plugin so that it can accept a path too rather than createFromLocation (or add a sub folder option)
Thanks
The text was updated successfully, but these errors were encountered:
Hi
We have a requirement to use a pre-populated sqlite database in an Ionic app but I have noticed that its not possible to include a db in the www directory any more as the files in www get deleted with every build.
The options are either you can have a custom config for your build or you can copy the db file into /src/assets folder which will then get copied into www/assets on build.
If you go with the 2nd option, this plugin will not create the database as it only tries to find the db inside the www directory not in the sub folders.
Below are the options I have used.
{name: 'sqlite.db', location: 'default', createFromLocation: 1}
With the option createFromLocation: 1, this can be fixed by appending "assets" to the "www" string inside createFromResource function.
on Android SQLitePlugin.Java ("www/assets/")
on iOS and SQLitePlugin.m ("www/assets")
With the above changes we can get the plugin to work correctly.
Are there any better solutions to this?
would it be better to update the plugin so that it can accept a path too rather than createFromLocation (or add a sub folder option)
Thanks
The text was updated successfully, but these errors were encountered: