Android 11 save game not working (sdk30)

Save game not working on android 11 (sdk30). Save games works perfectly on all devices except android 11. maybe because android 11 scoped storage
kindly help me iam stuck here from last 5-6 days

1 Like

Where do you “place” your save game logic? I think we need more informations :slight_smile:

Iam using two nodes as i used them everytime

Create save game object
Save game to slot

Save games working perfectly on all devices except android 11 devices

But i have read ue4.27 docs… They mentioned they have resolved some permission to get directories problems in android. I havnt checked but i hope its solved in ue4.27. Currently iam on ue4.26

Hi you must use the Game Instance for your save games and definitly check the storage permissions
I wrote an article how i solved the exact same problem, i translated it now in english, i think you can understand this:

(I hope its allowed to post an external url :o) - > https://defconnet.work/en/how-android-save-games-work-ue4-27/

SaveGame data is saved inside /storage/emulated/0/UE4Game/{Ue4Project}/saved/-------
with the extention of save game.
if you want to publish you game/app created in ue4 than you should Add MANAGE_FILES permission which is the simplest way bu the problem here is that starting this november all updates if consist of above permission will have to wait to seek permission from pay console about why your game/app requires this delicate feature.
adding above permission will automatically provide you will manage all files for API30 but for API 31 and above you have to add permission which i will write a blog when i will have time.

Their is more simpler way by which you can access savegame for newer API
i.e to edit SaveGameSystem.h in your Engine/Source/Runtime
add /storage/emulated/0/Android/data/{yourpackagename}+.savegame

3 Likes

Hello!

Can you tell me more about this changes and permissions at force please? :c

hi InLove4.
I would be writing a blog by tonight where i will explain changes and even add plugin to github(for permssions related android11, API30=+) for 4.27 and 4.26 which will itself modify the code.
you can see the blog at

I will ping here once i am done writing
You can always ask me question related to Android at
https://discord.gg/RvaxH54t
(my username in discord is MikeSrinivas)

4 Likes

That would be really great and helpfull. Stuck in this problem for months… Iam also waiting for your detailed working solutin. Thanks in advance

2 Likes

you can read the blog here I have made it as simple with pros and cons.
Anyone with still having problem feel free to ask anytime.
https://www.rearandroid.com/android11

2 Likes

thanks .i read your blog and it was the first thing i got handy for 30+ api in android.i have my game up and running and i am no good with android and find out each time when i update my update got rejected for past few days.
now i am aware why and I am currenly building my Engine Code as I have to download UE4.27 source code. i have edited the code but for some reason it rebuild again.
hopefully it update this time.

1 Like

sure

I can see you have already applied solution. Is it working properly for 30+… save games are now working for you???

The fastest way to solve the issue is as follows:

In SaveGameSystem.h

	virtual FString GetSaveGamePath(const TCHAR* Name)
	{
		FString saveDir;
#ifdef USE_ANDROID_FILE
		extern FString GInternalFilePath;
		saveDir = FString::Printf(TEXT("%s/SaveGames/%s.sav"), *GInternalFilePath, Name);
#else
		saveDir = FString::Printf(TEXT("%sSaveGames/%s.sav"), *FPaths::ProjectSavedDir(), Name);
#endif

		UE_LOG(LogTemp, Warning, TEXT("Save game path: %s"), *saveDir);

		return saveDir;
	}

PS: This solution requires no write permission because GInternalFilePath is set with getFilesDir() function call in native side and then set in AndroidJNI.cpp GInternalFilePath = FJavaHelper::FStringFromParam(jenv, internalFilePath);
(Data and file storage overview  |  Android Developers)

2 Likes

Have they still not gotten around to providing a native fix? Do we still need to do a source build for this?

1 Like