How to acess other capacitor plugins like sqlite in backgroundTasks.
I am currently working on a project where I need to synchronize the local SQLite database of my app with the server. To achieve this, I am considering using a background runner plugin to fecth data from db and make POST requests. But not finding any way to acess sqlite db inside background task and make post requests.
Did you find a solution?
https://github.com/capacitor-community/sqlite/issues/553
@theproducer do you have any idea when this might become possible? I think lots of people need SQLite to do their work 😅
Just my two cents, if somehow we made the capacitor plugin work inside the background worker, that would be far more powerful.
And I know that currently, we have put functions statically built in aar file.
Can put functionality to pass flags during compilation and include all required native code built inside aar files?
Hey guys,
we had the same requirement and went in a different direction based on the ideas of this repo: https://github.com/atroo/capacitor-background-runner-ng/tree/main
We are using a wrapper to generate the c++ bindings automatically for kotlin and we used the existing capacitor bridge, adapted it to be used in quick.js and created a PoC, where I could run the normal capacitor-sqlite and capacitor-app plugins without problems.
To move forward we need to merge this MR: https://github.com/ionic-team/capacitor/pull/7709 into capacitor-android. Basically it makes PluginCall.java more usable as it accepts an interface of an messagehandler instead of the existing messagehandler class. Any changes this will be merged soon @PratikBodawala ?
Hello everyone!
Yes, this has been one of known the limitations currently of BR since its release. We are working on brainstorming a solution that will theoretically allow all (at least the ones that make sense) Capacitor plugins usable within Background Runner. I should be posting a roadmap soon for things directly related to Background Runner (and Capacitor Watch).
@phal0r I can check out the PR, but its unlikely we will merge it anytime soon. We are in the planning stages of Cap 8 now, and as part of the new features, we may be working on a new bridge type within core itself, which, along with the changes I mentioned above, may solve the problem outright.
Expect more details coming soon!
Hi @theproducer ,
thanks for clarification. If it won't be merged, it makes no sense to review it :)
I would highly appreciate a roadmap about the direction of the capacitor to drive the community, especially if you plan to address the current biggest shortcomings. This will strengthen the trust in the project and make it easier to discuss using it in projects.
If you want to have more information about our take on background runner, feel free to reach out to me.