Kill tasks in background after some min?

hello everyone >>>
I send API from my app to my dataBase to save some info
and i used interval or observable.interval or setTimeOut
the problem is just in background mod and after 5 min in background no data save in database
i think my OS stop app tasks after 5 min , so i am looking for something to prevent OS stop my App tasks
any helps ?