Streaming music on Android devices is meant to play even when the device is locked. In some cases, the Music Streaming/Playing service stops the audio 5 minutes after the device is locked, and in some rare cases, causes the app to crash. The article provides information on why this occurs and how to resolve this issue.
Google has implemented a way to mitigate the most significant challenge that mobile devices face today – poor battery life. Although there have been improvements to make batteries charge faster, the technology behind batteries has remained pretty much the same, which is why Android 6.0 introduced the Doze mode.
There is a reason why apps and services come with WakeLocks built into them – without such WakeLocks, you would never receive your WhatsApp messages, your Gmail notifications, or your daily alerts. While the Doze mode is designed to curb these battery-hungry WakeLocks, it has been designed intuitively to allow high priority notifications.
Our apps do not have these features built-in as not all apps require the device to stay awake. Therefore these settings have to be manually optimized.
Go to Settings on the Android device running Android 6.0 Marshmallow and newer.
Scroll down to find the Battery tab and open it.
Open Battery optimization on the screen.
From the list of apps, scroll to find the one you want to disable Doze mode for.
Tap on the app icon and select the Don’t optimize option.
Press the Done button to confirm your selection and exit the Settings app.