1

I'm developing an app using the Spotify SDK. I noticed the total storage for the app grows pretty quickly after playing a few songs.

I am guessing this is because the songs are being cached.

Is there a way to clear the music cache using the Spotify SDK APIs?

I haven't come across anything in the documentation yet. If I clear it from the settings page, it clears all app data. The Spotify app seems to have a way to do it but I haven't found an API yet.

AADProgramming
  • 6,077
  • 11
  • 38
  • 58
  • Could this be of use to you? http://stackoverflow.com/questions/23908189/clear-cache-in-android-application-programmatically – George Daramouskas Jun 26 '15 at 20:40
  • are you calling Spotify.destroyPlayer(this); from onDestroy of your Activity or Fragment code when you are done with playing song? Because as per API Documentation of Spotify, If you do not call Spotify.destroyPlayer when you are done with the Player, then your app will leak resources. Here is the link:https://developer.spotify.com/technologies/spotify-android-sdk/tutorial/ – AADProgramming Jun 27 '15 at 07:11
  • Thanks. Yes I can confirm destroyPlayer is called when the app exits. I'm just wondering if this behaviour is normal operation. Google Play Music storage also grows. – user3509131 Jun 27 '15 at 14:16
  • 1
    There is a solution to this. Just add the line playerConfig.useCache(false); when configuring the player. – user3509131 Oct 08 '15 at 00:25

1 Answers1

1

I had this same issue and @user3509131,s comment solved it for me. Adding it as an answer for someone who might come looking.

The default max cache storage for Spotify SDK is 1024mb and useCache is set it True.

You can change it by adding the following line where you configure the Spotify player playerConfig.useCache(Boolean.FALSE)

hybrid
  • 1,255
  • 2
  • 17
  • 42