Plexamp Android: Everything is cache

I’ve downloaded a variety of music in Plexamp for Android so I can really test it out.

Once everything was downloaded, I checked Plexamp’s space usage. I was surprised to see everything was in cache:

There are apps out there, like Google’s Files, that can clear multiple apps’ caches at the same time. While Files send to suggest apps that haven’t been used for a little while, I’m a little paranoid I’m accidentally going to wipe out everything. And when you’re downloading a modest music selection like me, that comes with a fairly significant time, battery and possibly bandwidth cost! :sweat_smile:

I’m not an expert Android dev, but it feels like the ideal fix would be:

  • Store downloads in user data. This means they survive clearing cache at the system level.
  • Store caching (e.g. future songs in current playlist) in caches. This means clearing the cache in Android would be the same as the Delete Caches button in Plexamp.

If you can only have one storage area, I’d use user data over cache. At least there is the Delete Caches button, and it means a music library won’t mysteriously disappear!

There’s also the topic of migration. I personally don’t mind having to redownload everything should this get implemented. Ideally it would just be a case of clearing the app cache and then letting Plexamp resync! If no one else has mentioned it, then it’s probably fine doing this bare bones approach.

2 Likes

Fascinating, thanks for sharing this. I think you’re right, will check some more.

3 Likes

is there a way to change the download location to an sd card in android?

Putting downloaded music in user data is not how Android storage segregation is supposed to work. It’s more or less a hack, in the sense that it goes against design guidelines. You wouldn’t be able to do the same on iOS as Apple would surely flag it. Google’s design guidelines are more of a “suggestion” but that doesn’t make such a workaround any less wrong.

Currently Plexamp Android app stores downloaded music in cache and that’s how it’s supposed to work.

The function the OP describes is specifically designed to find app cache that are large in size so the individual user can make an informed decision whether to delete them to free up more space on their phone. Please do not mess with it.

I respectfully disagree on most of your points. I don’t believe there is an issue with what I suggested compared to the Android guidelines.

About the Apple comments: iOS guidelines do not apply to Android apps. In other words, what Apple allow or not is irrelevant to an Android app. Plexamp IS cross-platform though, so if Apple does have guidelines around where to store music, the iOS version of Plexamp should obey them. Not the Android version, though – it should obey Android guidelines.

On Android, I understand user data is data the user consciously wants to keep. Cache is transient data that is helpful for saving time/bandwidth/battery, but could be safely deleted with no impact to expected functionality.

When a user explicitly downloads a playlist, album etc. they are making a conscious decision to retain that data, even when offline. It is not expected that data would disappear unless they then removed that download (or something more drastic like uninstalling the app).

By having downloads as cache, this undermines that expectation: removing the non-functional cache will remove all downloaded music, and very much has a functional impact add far as the user is concerned – their offline playlists are no longer offline.

For music that was optimistically cached (i.e. streaming a radio station and downloading 10 tracks ahead), I agree that it should be considered cache. The difference is that the user didn’t explicitly request the music be available offline – the caching is merely provided to smooth out any bumps in the network. I gave a recommendation to this effect in my initial post.

However, I do want to make sure that I’m giving advice that fits in with the Android ecosystem. Since I’m fortunate enough to have access to other music apps with download functionality, I decided to download some music and have a look at where they cache their downloads.

Spotify uses user data:

Google Play Music uses user data:

YouTube Music uses user data:

Plex itself uses user data – there is also some cache, but it’s too small to be used for downloads:

In other words, Plexamp is the odd out by using cache exclusively. It’s my belief that this is an issue, hence I raised this request.

Thank you for challenging it and getting me to spend a bit more time looking in to it – thanks to having this data, I now have more confidence in my recommendation.

1 Like

The reason why all these streaming services put the music you downloaded/made-available-offline in user data is because they are NOT actual music files. At least, not in any user friendly way. They are data chunks laden with DRM, and they are not readily exposed to users via any file explorer apps, for obvious reasons.

Your own Plex music library is quite different-- it’s made of actual music files that can be played by other players/apps because they are DRM free and do not require routine license checks back to Spotify/YouTube servers, etc. They are ACTUAL FILES, not DATA.

Android recommendations for apps that handle user files is for the app to ask for storage permission and store the files in the file system. If you want things done the right way, that’s how. Then you don’t have to worry about any space management routine accidentally deleting your music library on your phone.

But since Plex’s whole point is to, shall we say, imitate the seamless/effortless user experience of a streaming service, they don’t want users to deal with file management outside of Plex’s own apps. This is why I said if Plexamp were to use “user data” instead of asking for storage permission, it’d amount to a “hack.”

But the difference is probably pedantic.

Also, when I said “please don’t mess with it.” This is what I was referring to. Which is probably an overreaction on my part. The Android devs on Plex team definitely knows why this is impossible.

I think we’re agreeing. Let’s make a couple of things really explicit and then I think it’ll fall in to place.

Let’s be clear on what “user data” is, at least as far as the app info screen I’ve sent screenshots of is concerned: it is persistent data specific to the app. That data can be files, blobs, preferences or databases. The Android docs have a good overview on it. The point is that it’s private to the app and persistent.

For this reason, I think your discussion on files vs. data is irrelevant to the discussion on caches vs. user data: how the data is originally stored at source doesn’t matter. The format of the data stored on the device doesn’t matter. It doesn’t matter if it is internal or external storage. All that matters is the scope (e.g. app-specific or shared) and persistence of the data.

This is one point where I agree with you: Plex and Plexamp are designed to be an all-in-one client that provides access to your Plex library and playback of it. For that reason, the data is app-specific.

An aside: If, instead, Plex were a sync mechanism that downloaded files for you to use with other Android music apps, then it would instead used shared storage. As you might expect, data in shared storage can be used by other apps. A common example would camera app – the photos you take are not part of the camera’s user data (you can confirm on its app info screen), but instead available for easy viewing, sharing and editing among many apps. Since the photos are no longer part of the app’s data, they’re also removed from the app’s lifecycle: if it is uninstalled, the photos remain. If uninstalling the camera app also deleted photos, most users would probably be quite grumpy.

Back to Plex. If the data is app-specific, we now need to decide if it is persistent or temporary. By app info screen terminology: If it is persistent, it goes in “user data”. If it is temporary, it goes in “cache”. That’s all there is to it. I believe downloaded playlists etc. are persistent, and optimistic caching is, well, temporary, hence the suggestions in the opening post.

There’s also the decision of internal vs. external storage. If I understand you correctly, the permission you talk about is only required for external storage. For data that an app wants to keep private (like with Plex), I feel this should really be a user decision. Google Play Music in my experience gives you this choice.

Sometimes there isn’t a decision to be made: the device I use only has internal storage, which means “external” storage is also on the same internal storage, just in a different place!

Finally, I’d also agree with you that storing cache data in the persistent area is a hack. It is by no means impossible. However, I only mentioned it in case the frameworks being used have limitations since it is a cross-platform app. Fingers crossed there’s no need for such a hack!

Once again, disclaimer: I’m not an experienced Android dev – I’ve done a bit as a hobby, but not really any file handling. I just use Android a lot and develop non-Android things. As such, there’s a possibility I’ve misinterpreted or misunderstood something and I’m keen for corrections – especially with links to docs!

1 Like

Hi, I came across this thread while searching for the info where Plexamp stores its downloaded music in a hope that it can access the already downloaded music I have in the Plex app.

I know very little about Android app development and the possibilities of storing its data.

I am really disappointed about the outcome. I would rather have options to chose from. In that case I would choose to store the data on my SD card and in such a way so it could be used by other apps. It would make things better even if it is allowed only to share it between the apps made by Plex, than letting sync both the apps and fill the SD card.
Until this is possible I will stay just with the Plex app.

Can somebody explain why do we have this duality?
Is there a plan to join the Plexamp code into the Plex app someday?

thanks and stay healty!

LH

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.