Accessing user-provided files in Android/data/com.my.app/files folder

Hi everyone!

My app allows users to provide files (3D models) by directly copying them into my app’s data persistentDataPath folder, so /Android/data/<packagename>/files.

Unfortunately, since a certain Android update a while ago, this does not work anymore. Files that my app writes to that folder can be read without any issues, but trying to read files that users have copied in manually (using Windows Explorer for example) will throw an exception: System.IO.IOException: Permission denied. I can see the files from within the app and list them, but reading fails.

I assume that I would need the permission android.permission.MANAGE_EXTERNAL_STORAGE to get access to those files due to how file access permissions are handled now, but I doubt Google would grant my app that permission (I hear they are very picky with that).

I only need access to user-provided files in MY app’s specific data folder, not any other folders… It seems a bit crazy that this is so heavily restricted now.

My questions:

  1. Is there any good way to get around this and still be able to access those files?
  2. If not, what would be the best-practice way of handling this kind of scenario? Is there some other folder somewhere that is present on every Android device that I could ask my users to save files to so my app can read them?

Bump.

If anyone has any suggestions, let me know.

I’m needing to do the exact same thing, wanting to be able to load a text file provided by my app’s user on Android. Frustrating how challenging this is proving to be.

Bump. Still don’t have any solution for this, would appreciate any idea.

My best work-around so far is that my user can get their text file into the app by copying their text and then pasting it into an input form in my app. Clunky, but works so long as the number of characters doesn’t exceed any Android OS clipboard size limits.

But would still a way to easily read and write text files on Android that the user can easily access via accessible file folders.