Folders on Android

When I use some values Special Folders.ApplicationData I get back values like /data/user/0/<package>/files/config. But using explorer-like apps I can’t find anything. The folders don’t exist. This is on a real device. I’m not experienced with the android file system structure. Is there something I am missing?

I want to be able to write and read some app data. What is the best place to write this data to? I want to write crash reports and later also serialize some settings probably.

Hey, so I found this when I was looking around in our earlier discussion…

https://developer.android.com/training/data-storage/app-specific

It looks like they changed their API in Android 10. I wonder if access to that folder is prevented now? My device is older, so maybe it doesn’t have this support. My code uses the older, deprecated folder to write files (which still works), and my files show up in the expected place.

It could very well be that my phone (Samsung Galaxy S8) has a way to view this. I get to it by going to My Files (Samsung App), then selecting Internal Storage. This lets me browse the files stored there.

I don’t really have a lot of experience with other devices, so if you don’t see this, I’m not sure where else to look :frowning:

*Edit: It occurs to me that your app might not have storage permissions. There’s a way you can force this on for your app to test, but I can’t recall offhand how. Google this :smiley:

If that’s what’s holding you back, let me know. I have some code handy that will allow you to check to see if you have the permission and if you don’t, request it.

1 Like

I checked and from the last test I already used one the app specific folders. I tested on an emulator with android 10 I think. I could read the text file back. So far I just refactored / cleaned up the source a bit which is responsible for writing the crash reports / logs text files out to be able to test better and see how it works. From a first glance at the link I think the issue was maybe that since newer Android versions the app specific folders are encrypted and also are only readable by the app itself, not others (there are shared folders / places too for this scenario). I think that is why I could not see anything browsing the places with another app.

So I am wondering now, what is the best way, to get those crash reports back when the app crashes on a testers device for example. The app itself can not be used because it crashes… The crash report can’t be accessed by others apps because everything is encrypted and not accessible… So that leaves the option to write it to external storage where other apps do have access, right?

I am open to suggestions and advice how to organize the crash report reporting, I mean how to enable testers to get those back to me in the most simple and robust way.

That might be a good idea. I did a quick google and it should work the same way. Write your settings and save data to internal storage, and write your crash reports and logs to external storage?

The only other thing I can think of would be to send that crash report to a server you host… but honestly, that’s a pain in the butt and would require a fair bit of infrastructure. Maybe something to consider down the line if your game takes off, but in the early dev stage when you just want feedback, a file your testers can send you is waaaaaay easier to implement.

1 Like