Synch database with Health App by Ionic App when app is closed


I try to sync the database used by my Ionic Angular app when the app is closed(not in background).
Something similar to a job that runs once a day, which takes data from the Health App using the HealthKit Capacitor plugin and saves it in the database used by the application (get data from Health App endpooints and call some endpoints to save data in a sql database).
I don’t know if it’s possible to do that in Ionic(to do some request when app is closed).
If you have any suggestion how to do that or which plugins to use please leave a comment.

not that this is a limitation of Ionic, but a limitation of any app really. One an app is closed, tasks cannot be run. The main concern being privacy since letting an app run some random task in the background is pretty permissive, so probably not something that Apple or google would be ok allowing.

Thank you very much!