# How to get a working Android Savegame \[Tutorial\]

**URL:** <https://forums.unrealengine.com/t/how-to-get-a-working-android-savegame-tutorial/541286>\
**Category:** Mobile\
**Tags:** unreal-engine, Android\
**Created:** [April 27, 2022, 5:59pm UTC](https://forums.unrealengine.com/t/how-to-get-a-working-android-savegame-tutorial/541286 "2022-04-27T17:59:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Enilads](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/enilads/32/590284_2.png) [@Enilads](https://forums.unrealengine.com/u/Enilads)\
**Post date:** [April 27, 2022, 5:59pm UTC](https://forums.unrealengine.com/t/how-to-get-a-working-android-savegame-tutorial/541286/1 "2022-04-27T17:59:10Z")

</div>

Hello,

I have seen many people writing that their savegame works on their computer but not on their Android device. This is because Google has introduced scoped storage with Android 10.  
https://developer.android.com/about/versions/11/privacy/storage

I have found a solution that is not quite perfect because it only works in Shipping Mode if you only want to test your game you should set the Target SDK to 28 (Android 9).

The steps you need to do to get your savegame working on your Android devices are:  
ㅤ  
ㅤ  
Step 1.

Set the build configuration to Shipping and check “Full Rebuild” and “For Distribution”.

 ![135235](https://d3kjluh73b9h9o.cloudfront.net/original/3X/a/a/aabc9f6efb2196047be1e613138a857748580049.jpeg)  
ㅤ  
ㅤ  
ㅤ  
Step 2.

Set the Target SDK to 31 and check “Use ExtenalFilesDir for UE4Game files?”

 ![3632326](https://d3kjluh73b9h9o.cloudfront.net/original/3X/8/4/84a5f1085cf61fff23e54ea572e4e6ac0852363c.png)  
ㅤ  
ㅤ

Step 3.

Open the windows prompt and go to the Java/jre/bin folder with the command “cd C:\Program Files\Java\jre1.8.0\_291\bin” (If you installed it somewhere else, enter your own installation directory).

 ![Administrator_ Command Prompt 26_04_2022 22_20_12 (2)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/1/b614c526048005895d1da28e6f4100a2cf3efc99.png)

Step 4.

Enter this command to generate the Keystore.

keytool -genkey -v -keystore ExampleKey.keystore -alias MyKey -keyalg RSA -keysize 2048 -validity 10000

 ![Administrator_ Command Prompt 26_04_2022 22_20_30 (2)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/3/3/e3312d2e706f09e0e5dba8f634dcbf66805009d6.png)  
ㅤ  
ㅤ  
Step 5.

Create a password for your Key Store and answer all the questions that are asked.  
If it says [Storing ExampleKey.keystore], everything worked.

 ![Administrator_ Command Prompt 26_04_2022 22_22_09](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/f/3/2f34dca902ced653f8d21a17ea94aca3b011fd11.png)  
ㅤ  
ㅤ  
Step 6.

Copy the ExampleKey.keystore file from the Java/jre/bin folder into the Build/Android folder.

 ![Android 27_04_2022 18_57_44 (2)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/2/eb2e55e9bbf0bf938ecaaa04f1b2dec25f27029d.png)

ㅤ  
ㅤ  
Step 7.

Go to the Android Project Settings in the Unrel Engine and scroll down to “Distribution Signing”.  
Enter the full filename, Alias and password of your Key Store.

 ![Android_Savegame - Unreal Editor 27_04_2022 18_58_10 (2)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/1/2/6124895eb1a30fe95033acfa5a1ad0f6553640fb.png)

ㅤ  
ㅤ  
Step 8.

Package your game and your savegame should work.  
ㅤ  
ㅤ  
ㅤ  
Extra information:

I have often read that people think that the savegame is deleted after an update but that is not the case at least if you update with the apk. I don’t know how it is via the playstore.

I hope this tutorial can help you if I have made any mistakes let me know  
ㅤㅤ  
ㅤ  
ㅤ  
I have also made a youtube video that shows all the steps of this tutorial.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/5/9/859aa363efd930fc0cb8c3e4380db9d59233543b.jpeg "How to make a working Android Savegame in Unreal Engine 4") ](https://www.youtube.com/watch?v=43cob5nw1-A)

---

<div class="post-metadata">

**Author:** ![dev.ue.games](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dev.ue.games/32/466816_2.png) [@dev.ue.games](https://forums.unrealengine.com/u/dev.ue.games)\
**Post date:** [April 28, 2022, 4:33pm UTC](https://forums.unrealengine.com/t/how-to-get-a-working-android-savegame-tutorial/541286/2 "2022-04-28T16:33:13Z")

</div>

> [@Enilads](#):
>
> I have seen many people writing that their savegame works on their computer but not on their Android device. This is because Google has introduced scoped storage with Android 10.

 ![Screenshot_77](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/f/f/affbfacc018ab98157890b60d2ed0e03fceccd99.png)  
that’s how i fixed it … and updating from play store my game on android 11 doesn’t remove my save

---

<div class="post-metadata">

**Author:** ![crossmr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@crossmr](https://forums.unrealengine.com/u/crossmr)\
**Post date:** [October 26, 2022, 10:46pm UTC](https://forums.unrealengine.com/t/how-to-get-a-working-android-savegame-tutorial/541286/3 "2022-10-26T22:46:15Z")

</div>

Thanks for the tutorial, however I’ve followed all these steps exactly on Unreal 5.0.3 with android 11 (galaxy s22) and this still does not work. Save games work fine on the PC, but just refuse to work on android.

I should note that after applying your changes, when I uninstalled and installed (to make sure it was fresh) it was not asking me for file permission this time when it had been asking every time previous.

I went to the app and manually gave it file permission, but it still didn’t work.

---

<div class="post-metadata">

**Author:** ![crossmr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@crossmr](https://forums.unrealengine.com/u/crossmr)\
**Post date:** [October 30, 2022, 8:08am UTC](https://forums.unrealengine.com/t/how-to-get-a-working-android-savegame-tutorial/541286/4 "2022-10-30T08:08:42Z")

</div>

> [@dev.ue.games](#):
>
> > [@Enilads](#):
> >
> > I have seen many people writing that their savegame works on their computer but not on their Android device. This is because Google has introduced scoped storage with Android 10.
> 
> ![Screenshot_77](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/f/f/affbfacc018ab98157890b60d2ed0e03fceccd99.png)  
> that’s how i fixed it … and updating from play store my game on android 11 doesn’t remove my save

I decided to download source and make a source build. I did that and made your change as you indicated here. This made no difference. I also tried another change someone else has suggested:

```auto
This needs to be added to the libraries on top of the class.
#include "Misc/App.h"

And this is how I solved the SaveGame implementation.

virtual FString GetSaveGamePath(const TCHAR* Name)
    {
#if PLATFORM_ANDROID 
        // ProjectSettings->Platforms->Android->APKPackaging->AndroidPackageName()
        FString BundleID = FString(FPlatformProcess::GetGameBundleId()); 

        // ProjectSettings->Description->ProjectName()
        FString AppName = FString(FApp::GetProjectName());  
             
        return FString::Printf(TEXT("/storage/emulated/0/Android/data/%s/files/UE4Game/%s/%s/Saved/SaveGames/%s.sav"), *BundleID, *AppName, *AppName, Name);    
#else
        return FString::Printf(TEXT("%sSaveGames/%s.sav"), *FPaths::ProjectSavedDir(), Name);
#endif
    }

```

This has also resulted in it not working. Can you think of anything else that would prevetn the game from saving properly? I’ve verified the app has permission and it is properly asking for permission

---

<div class="post-metadata">

**Author:** ![Enilads](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/enilads/32/590284_2.png) [@Enilads](https://forums.unrealengine.com/u/Enilads)\
**Post date:** [November 7, 2022, 7:38pm UTC](https://forums.unrealengine.com/t/how-to-get-a-working-android-savegame-tutorial/541286/5 "2022-11-07T19:38:50Z")

</div>

Hello crossmr

I have tried it with the test app shown in the tutorial with the unreal engine 5.0.3 on several devices and the savegame works on all of them.  
(I tested it on a Oneplus 8T, Redmi Note 9 Pro and Samsung Galaxy A31).

I have uploaded the Project files and APKs that were made with UE 4.26 and 5.0.3 so you can check if it works for you.

[https://drive.google.com/drive/folders/1LmYkJDdi2j\_Wm4B0CrPfOAsZOvwv6Q84?usp=sharing](https://drive.google.com/drive/folders/1LmYkJDdi2j_Wm4B0CrPfOAsZOvwv6Q84?usp=sharing)

---

<div class="post-metadata">

**Author:** ![crossmr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@crossmr](https://forums.unrealengine.com/u/crossmr)\
**Post date:** [November 7, 2022, 7:50pm UTC](https://forums.unrealengine.com/t/how-to-get-a-working-android-savegame-tutorial/541286/6 "2022-11-07T19:50:20Z")

</div>

Thank you, I’ll give that a shot and see if those work for me.
