Keep app open in the background

a help please. When I run my app and I need to open another app, my app has not been closed and is still open. By clicking on its icon, the app will be in the foreground again. However, if I take too long to click on it, even though it is in the background, the app restarts. how to solve this problem?

I’m already using the blocks:
On app Pause and on app Resume.
I left these blocks with nothing inside

Well it is not a problem of app it is the problem of the device that you are using some device features does not allow app to work in background due to battery saver.
To solve this first you have to disable that feature for your app in device or another way you can use background task extension