the OS won't let you do that reliably unless the user also keeps opening the app. background processing is heavily limited for the right reasons.
Does it occur to you that there are so many different variants of Android and they all do their own thing regarding background processes? It is so complicated that you can find websites like this https://dontkillmyapp.com/