Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the plugin with Ionic v4/v5 #89

Open
sachithd opened this issue Mar 4, 2020 · 0 comments
Open

Using the plugin with Ionic v4/v5 #89

sachithd opened this issue Mar 4, 2020 · 0 comments

Comments

@sachithd
Copy link

sachithd commented Mar 4, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant