How to stop streaming apps like Spotify from randomly shutting down

Modern Android phones make excellent devices for streaming media. Whether that means watching video on YouTube, listening to music through an app like Spotify, or indulging in an audiobook from Audible, your phone and a good set of headphones are all you need for a first-class experience.

Unless that experience gets interrupted by the app randomly shutting down, that is.

Here's a quick look at what's going on and what you can do to try and prevent it from happening.

Why it happens

The reason that streaming apps can stop abruptly and shut down has good intentions behind it — to save your battery.

Android and the phone manufacturers that use it know you want your battery to last forever on a single charge. That's not possible, but what can be done is to add tools inside the system that keep apps from chewing through battery when they are not in focus — particularly in the foreground.

Android itself can have an unlimited amount of applications running. When the software is built, engineers alter a bit of the code to match how many apps can run based on the hardware used to build the phone. It's complicated, but those engineers can set parameters about how much memory apps can use while you're looking at them, while they are running in the background, while they are "sleeping" in the background, and apps that support other apps. When that number is reached, the system will start closing apps based on how they are running, not when they were last used.

RAM: What it is and when do you need more?

An app that is on your screen and you're interacting with is in focus. That means plenty of system resources are allowed to be used because it's assumed that you want that app up and running and are OK with it using battery power.

But an app like Spotify doesn't really need to be on your screen to work to its full potential, so it should be able to tell the system that it still needs to be "in focus" — and therefore kept alive — even when it's not actually open on the screen. It should be able to use things like battery power or your network connection because you asked it to.

Every company involved with Android, including app developers, wants to conserve battery. The people developing the hardware and software are constantly tweaking things to get just a tiny bit more life from a charge because all those tiny tweaks will add up. Android itself has seen Google make plenty of changes between versions here and companies like Samsung also have done a lot to save battery power whenever it can. And sometimes, those tiny changes don't work great with each other.

It's not difficult for a tiny change to force your phone to think an app like Spotify isn't in focus as described above when you're streaming, and the rules about when and how apps that aren't in focus should be shut down to save battery are very different from the rules for apps you're using.

And that's often the problem here. You start Spotify (or Audible or any other streaming app) then move on to check the weather or read your Twitter timeline, and your phone thinks Spotify isn't something that should be eating up all the battery power it's using.

And that is a simple fix.

How to fix it

There are plenty of other factors that could be shutting down an app, but most of the time this will fix Spotify when it wants to shut down all the time — change any extra battery-saving features.

These are tools added on top of those settings that decide how apps can use resources. They're put in place by the company that made your phone and are a way to be more aggressive about closing apps that use battery power when you're not actively looking at them on your screen. Different companies make these changes in different ways, but the result is the same — your phone slows down a tiny bit, your screen won't get as bright, and apps that aren't up front on your screen aren't allowed to use your connection and chew up battery power the way they would normally do.

To fix the problem, you need to disable any battery-saving features associated with the app that's shutting down. Different companies have slightly different methods, but in the end, the result is the same.

Samsung phones — Marshmallow (Android 6.x)

If your Samsung phone is stuck on Marshmallow, here's a tried-and-tested solution that doesn't involve battery optimization but rather access to background data.

Note: If your Samsung phone is running Android 7.0 or later, skip this step and go to the one below.

  1. Open your Settings.
  2. Tap the Data usage entry.
  3. Tap on Background data.
  4. Find the app that's giving you trouble on the list.
  5. Make sure the switch beside it is set to enabled.

Samsung phones — Android 7.0

On a Samsung phone running Android 7.x Nougat or later, the steps are simple.

  1. Open your phone's Settings menu.
  2. Open Device Maintenance.
  3. Tap Battery.
  4. Tap Battery usage.
  5. In the three-dot menu button (top right), tap Optimize battery usage.
  6. In the drop-down menu, select All apps.
  7. Find the app(s) you want to unoptimize, and deselect it.

Pixel and Nexus phones — Android 7.x or later

If you have a Pixel or Nexus phone running Android 7 (Nougat) or later, try this:

  1. Open your Settings.
  2. Find the entry for Battery and tap it.
  3. Tap the menu button and choose Battery optimization.
  4. At the top, you'll see a drop-down menu. Open it and choose All apps.
  5. In the list, find the app that's giving you trouble and choose Don't Optimize.

Android uses a system tool called Doze to control how apps use power in the background. With Android 7.0, Doze became much more aggressive and there have been a few problems with streaming apps when the screen shuts off. Selecting the Don't Optimize option tells Doze not to try and control how the app behaves when not in focus.

Battery optimization is important, and you should leave the feature enabled for most apps. We only recommend disabling it for streaming apps on phones where memory and battery management is just a bit too aggressive.

And these solutions aren't perfect. And while it rarely happens, a glitch could allow an app like Spotify to run constantly and use all of your battery. App developers and companies that make Android phones know this, too, and are constantly working to fix issues like this with minor updates so it's important you make sure you're accepting system updates and app updates from Google Play.

In the meantime, these tweaks will get you back up and running with your favorite sounds still playing in the background!

Jerry Hildenbrand
Senior Editor — Google Ecosystem

Jerry is an amateur woodworker and struggling shade tree mechanic. There's nothing he can't take apart, but many things he can't reassemble. You'll find him writing and speaking his loud opinion on Android Central and occasionally on Twitter.