to work as intented, please follow the instructions below.
• Enable the padlock icon at an app in the right top corner in the overview of running apps. It’s only then actually running as a foreground process. If you swipe it away, its background process will be killed mercilessly.
It does not matter if the battery/power optimization is on or off in Settings!