capacitor-community / sqlite

Community plugin for native & electron SQLite databases
MIT License
426 stars 104 forks source link

Can I use this plugin inside the background runner capacitor plugin? #553

Open vycoder opened 2 weeks ago

vycoder commented 2 weeks ago

I'm working on an app where I use this plugin mainly for offline functionality, but while online I perform certain replication functions to update the offline database as the app is being used. I'm running all this logic in the main thread but I'm wondering if I can leverage Capacitor's Background Task Runner(https://capacitorjs.com/docs/v5/apis/background-runner) along with this plugin.

Or is my approach may not be the correct one? I would appreciate if anyone can shed light on this or can point me in the right direction.

petterbergman commented 1 week ago

Currently capacitor doesn't let you use plugins in the background runner. Only the libraries they have statically added are available, which is pretty much just CapacitorKV and fetch. Using those, you can get data from your server, but you won't be able to write the data to Sqlite.

The capacitor team has indicated they're hoping to have this working in the future, but no timeline or specifics.

jepiqueau commented 1 week ago

@petterbergman thanks for the info