The Problem
The problem looks like the following: Spotify, Google Play Music, Radio or any other music player app stops playing in about 2 minutes after Samsung Galaxy S10 (S9, S8), Note 10 gets locked. Here’s how to fix on Android 9 Pie.
There is an aggressive mechanism of power saving on Android 9 Pie and Android 10 Q. The operating system tries to put every other app to sleep to prevent the battery drain.
But when it comes to audio players (and Spotify in particular) such extreme power saving behavior can turn out to be excessive and stop music playback after a few minutes (automatic screen lock by timeout) or even after a few seconds (if you lock your screen by pressing the Power button).