UE4 does not save it’s data in the program’s data folder. Instead it stores it in a folder in the root directory separate from the game.
Should store data in:
/Android/data/com.[comany].[project_name]/
Actually stores it in:
/UE4Game/[name_of_uproject_file]/
There are many problems with doing this:
It requires an extra permission. (Makes customers suspicious and rightly so.)
It doesn’t clean up on uninstall. The files stay there and you have to use a file manager to remove them. I discovered >2000 files in that folder from games that have been uninstalled.
Problems persist even after reinstall. Side effect of #2. Asking a customer to install a file browser to remove a corrupted save file is not ideal. (Actual problem that I am facing)
Other apps can access the files. This may or may not be desired but should not be the default because it’s insecure and prone to error if they are unexpectedly modified.
This is essentially the same as asking for nearly full admin privileges on windows just to run a game.
The addition of runtime permissions in 4.16 sounds like a step in the right direction. Hopefully it means that you have already fixed this as well but if not it would be an opportune time to fix this since you are already making changes.
This can be resolved by checking the “Use ExternalFilesDir for UE4Game files?” checkbox in your Project Settings under Platforms > Android > APKPackaging.
Looks like we might have to upgrade our project after all, we were avoiding it due to the changes to the bloom rendering making our game look extremely different. Will have to see if we can find some settings that will work.
Thanks for the assist on this! I’ll let the people in the other questions I’ve seen for this know.
I’m experiencing a problem related to this checkbox.
When I check “Use ExternalFilesDir for UE4Game files?” in UE4.26 and deploy a shipping build to an Android API 25 platform (Oculus Quest), my app is successfully able to save/load save files, BUT I am unable to access these files on the device when connected to a PC or Mac. I want to be able to backup my SaveGames. It seems that while these files are visible to the app, but they are invisible to the user. This sounds similar to the function of Android’s Scoped Storage system, which I have attempted opting out of by using the Android manifest application tag requestLegacyExternalStorage as well as adjusting the Target API to 29, but still the same result (files are invisible to the user).
When “Use ExternalFilesDir” is checked, I believe the intended save directory is:
/Android/data/com.[comany].[project_name]/files/UE4Game/[project_name]/Saved/SaveGames/
Yet, when attempting to visit this directory as a user, all that is found is an empty folder:
/Android/data/com.[comany].[project_name]/files/UE4Game/[project_name]/Saved/
Target API 30 ignores “requestLegacyExternalStorage” Setting. That means you have to ask the User for external storage read/write permission. And even if the player grants you these, know that after each update or uninstall those external files (even savegames) get erased. If you want to save files internally than only in the app directory, and that “should” work by default (according to Google), but actually does not work as well.