Execute code in the background, what is the best solution?

Hello,

I need your advice!
In my application I need either:

  • Execute code periodically, even if the application is not launched or the phone has to restart;
  • Or to execute code when I receive a silent push notification, even if the application is not launched;

Do you have any ideas for implementing this? (cordova, ionic, capacitor, …)

Thank you in advance for your advice