Background activity

Hi everyone!

My name is Nick. I’m struggling with something. I’m building an app. This app needs to have multiple notification channels. One for important news and three for the normal local news of three cities.
I want to do this with our own server. I have written the function for it. But I need to run the function in the background, when the app is closed. I have not managed to do this, I have also not found anything about this that can help me.

Is three someone who can help me let a function run in the background. (Because the function needs to get the latest news, three is a setInterval around it)

I hope someone can help me. Thanks in advance!,