Android 11 – Accessing Files in my app Android/Data folder

I Think I Have An Answer?

The more I read about this – it appears that Android 10 went one way, and then Android 11 back tracks it a little and re-enables some of the direct file path access.

Hopefully I’m right on this and won’t have to come back and re-do things again down the road

So the answer is to use the requestLegacyExternalStorage in the Manifest – even though it’s got all kinds of warnings

And then I created a folder in Documents with this

File filePath = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)+File.separator+"MyAppFolder");
filePath.mkdirs();

And Now I can write to this and read from it.

Anyway – this seems to work for me on Android 9, 10 and 11. So hopefully the trend forward continues.

Leave a Comment