Samsung closes itself the apps when you’re not using the app. Yes, Samsung is following a severe divergence from standard Android about the background app management. Samsung is now in the first (the badder is first) position on this topic, see dontkillmyapp.com.
To partially prevent this, please follow these steps.
1. Lock the app in Recent
- Open Recent apps.
- Find Your app.
- Long-press the icon of the app.
2. Battery optimization
To keep your apps working properly make sure you enable:
Settings -> Apps -> Your App -> Battery -> Battery optimization -> All apps -> Your app -> Don’t optimize.
3. Optimize battery usage
Settings > Apps > (⁝) menu > Special Access > Optimize battery usage
4. Auto-optimize daily + Adaptive power saving
5. Adaptive battery
6. Lists of Sleeping apps, Unused apps, Deep sleeping apps, Never sleeping apps
Make sure Put unused apps to sleep is disabled. Otherwise, Samsung will put your apps back to sleep after a few days (3 by default) even if you have woken them up manually!