On my Android app SDL reports my app’s user folder as:
But if I use the Android emulator’s Files app I can’t seem to find that folder. Is that accessible via the Files app?
What I’m trying to do is allow users to drop some files in there which my app will see, and then use to mod the game with.
Hmmm… after some Googling it looks like the path given from SDL_GetPrefPath isn’t accessible by a user on an Android device unless the device is rooted. So, I’m thinking of looking for files in the device’s Download folder. Anyone know if that is accessible by an app, and how to get the path to the Download folder?
On my Android 13 device the Cx File Explorer app can access the files folder, i.e. the folder returned by
SDL_AndroidGetExternalStoragePath(). That’s what I use to do what you suggest.
Alternatively that folder can be seen from a PC via a USB connection, so a user can access it that way.
The problem that you’re going to face is that there is a lack of consistency between the versions of the Android API’s. (Some of the changes are vastly divergent). There are several solutions for different API’s found here → java - how to access downloads folder in android? - Stack Overflow
If your API doesn’t work for any of those solutions, then search specifically for your API level.
Option 1: If this is a hobby project, then just develop for the API you own.
Option 2: Detect the user’s API and develop for multiple versions in a catch-all branching function.
Option 3: Pick the most used API and develop for that, update as needed over time. (You can specify the min and max API that you are targeting.) → How to Change the API SDK Level in Android Studio? - GeeksforGeeks
Perhaps someone knows of a kind of unifying library?
Thanks and that sounds like it could be the solution. But, using
SDL_AndroidGetExternalStoragePath(). I get told the folder is:
I’ve got a Huawei phone so couldn’t see Cx File Explorer on the Huawei store, but downloaded one called File Commander Manager & Cloud. But when I use that I don’t see how I can access that folder I need? I see lots of other folders in /Internal storage/Android/Data like com.android.providers.media and com.huawei.browser etc… but not my game’s folder. And I don’t see how to get to /storage/emulated/0/Android/data/ ?
In that case Sideload the APK directly from the Cx File Explorer website. And if Huawei doesn’t let you Sideload APKs, throw the phone in the bin!
I suspect that’s just an alias for a folder called something different when accessed from a file manager. My app sees:
but in Cx File Explorer it’s shown simply as:
and in the File Manager supplied with my OnePlus phone it’s: