[ionic 5] Run function on app exit

Hello there,

I want to build an app where I want to schedule a function which runs in every 5 hours. The most crucial part of this is to execute function even when app is completely closed. I have tried to look into the android documentation and I found about the work manager but I do not know how can this be implemented in ionic for scheduling jobs and running them even when app is closed.