Jump to content

Adding full SD card access to the Emby Server for Android?


Sanras

Recommended Posts

Hello, 

Are there any plans to add full SD card support to the Android server app? As a few users here have already experienced, I cannot set my library to any location on the SD card other than Emby Server's folder in /Android, due to the permission denied error. This is because the app doesn't have SD card write permissions, so it is limited to only it's own folder on the SD card. Normally most apps that need access to write to the SD (Such as a file explorer) Will simply pop up a dialog telling you to select the SD card in order to grant it write privileges. After that, the app is able to write to any folder on the SD card without issues. Is it possible to implement this on the server app? For example, just add a button that says "Grant SD Card Permissions" Which would pop up the sd card select window, and allow us to select the SD card and grant the server write privileges to it.

 

Edit - I found what I was talking about, it's called Storage Access Framework. Since Google removed direct write to the external SD Card since Android 4.4, you need to use SAF to access the SD card from then on. Implementing this in the server app would fix the permission denied error me and other users are facing.

 

Documentation - https://developer.android.com/training/data-storage/shared/documents-files

 

This specifically is what needs to be implemented - https://developer.android.com/training/data-storage/shared/documents-files#grant-access-directory. ACTION_OPEN_DOCUMENT_TREE will open the file picker dialog I was talking about. When the user selects the root of the SD card, the app calling ACTION_OPEN_DOCUMENT_TREE will automatically be granted write access to the SD card and all its sub-directories.

Edited by Sanras
Link to comment
Share on other sites

The Android OS is getting stricter and stricter with each new release.

Emby has no choice but to work within what Android allows.

You can of course move all the files to the proper spot on the card and it should work just fine going forward.

Link to comment
Share on other sites

This isn't about what the Android OS does or doesn't allow. SD card read/write is allowed in Android, and can be taken advantage of by any app you install. That's how apps like file mangers can write files to the sd card. It's completely possible to do, and the method for doing it (Storage Access Framework) is in the Android developer documentation. The problem is that it's simply not implemented in the Emby Server app.

Link to comment
Share on other sites

The problem is that it's going to require rewriting the server's entire file access layer to use storage access framework, rather than the traditional java file api. Even if we did that, in our experience with using it in the mobile app it does not perform as well, which could be a problem with realtime streaming and transcoding. Now granted, SD cards are slow anyway so perhaps that wouldn't matter, but on other types of storage devices it may.

Link to comment
Share on other sites

  • 2 years later...
GregMo
On 2/11/2021 at 1:50 PM, Luke said:

The problem is that it's going to require rewriting the server's entire file access layer to use storage access framework, rather than the traditional java file api. Even if we did that, in our experience with using it in the mobile app it does not perform as well, which could be a problem with realtime streaming and transcoding. Now granted, SD cards are slow anyway so perhaps that wouldn't matter, but on other types of storage devices it may.

This same permission will allow you to access connected USB drives that are pretty fast.  I have an older Android that I got this working on but can't get it working on newer ones.  I'm about to the point of rooting the phone just to get around it.

  • Agree 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...