1

When I use the Spotify Android SDK to play music and Doze kicks in, the music stops playing because the app loses network connectivity. Is there a way to solve this?

The only way I can think of is ask the user to whitelist the app using a ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS intent. But I read that a lot of developers get their app banned from the play store when doing that.

RuudJ
  • 53
  • 8

1 Answers1

1

Running the Spotify instance in a foreground service fixes the problem. See https://developer.android.com/guide/topics/media/mediaplayer.html#foregroundserv

RuudJ
  • 53
  • 8