Saving and loading problem on android only
I'm using this save system in my game:
I have this system in 3 blueprints in my game scene which are going to be saving/loading data somewhere during run time. They're always on the "Event begin play" and "Event Construct" nodes.
When I need to save a value I use:
When I need to load a value I use:
and It works fine... In editor and development builds.
Now in shipping builds it's a whole different story.
First of all I have it it so the game is in one apk file and I have the "Use ExternalFilesDir for UE4Game Files" Option unchecked since I found it to be very prone to exploitation from the player, I also wanted the saves to be persistent through uninstalls. I added the following permissions to the "Extra Permissions" Section of the Advanced APK Packaging menu: android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_EXTERNAL_STORAGE android.permission.WRITE_INTERNAL_STORAGE android.permission.READ_INTERNAL_STORAGE
I also added the to the android manifest manually just in case.
If I build my APK as a development build, everything works fine, the APK asks for external storage permission on installation and the saving and loading work fine. When I try building my APK for distribution though the APK does not as for any permission and the saving and loading don't work, I then go inside the app permissions in my phone's settings menu and manually grant the game storage permission which makes the menu scene able to "sometimes" save and load a value or two, however the game scene is still unable to save/load anything.
I've been pulling my hair out on this issue for a while, testing it on multiple devices and trying a bunch of different solutions that proved fruitless such as trying the "Use ExternalFilesDir for UE4Game Files" option.
at the moment I'm at my wit's end and don't have a clue where to go from here, without this feature I really don't have a game, so any help you can provide my with is very very much appreciated.
Thanks in advance.
Don't know if it's the full picture, but since the latest android patch, my device is not granting "storage" permissions to the game when installed from the PC. But you can go to "App Info" on the device and grant it manually, now my game is saving again. I wonder if it'll have this issue when installed from the Google Play. hope not.
I though it was 4.21, but it seems is not an issue on UE4 side. but on how Android treats Apps installed from wherever.
answered Nov 11 '18 at 04:49 AM
Hi did you had a chance to test on the "Google Play" side if it is working without extra permissions?
as per 4.21, the save slot file is in the PrivateStorage of the app so it should not required extra permissions. I opened a case on this. I will update here if I have a feedback.
As of today, I had to put the ExternalFileDir option to true in order to not block my development process, but I won't publish my game with this option set to true
answered Jan 18 '19 at 11:47 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here