Dialogue System when uninstall on android

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
rauljl1
Posts: 55
Joined: Fri Apr 15, 2022 7:40 pm

Dialogue System when uninstall on android

Post by rauljl1 »

Hi, Tony.
I would like to know what happen with the variables and save slots when you uninstall an app on android.
I noticed that some variables are reseted, but others not. I think it may be due to something in the android backups, but I'm not sure.

This is my code/possible solution:
private string LoadLocal()
{
//First time installing
if (!File.Exists(PLAYER_PATH) || string.Equals(version, "0.0.0"))
{
File.WriteAllText(PLAYER_PATH, JsonUtility.ToJson(playerSO));
PlayerPrefs.DeleteKey("version");
PixelCrushers.SaveSystem.ResetGameState();
PixelCrushers.SaveSystem.DeleteSavedGameInSlot(1);
PlayerPrefs.SetString("version", "0.0.0");
PlayerPrefs.Save();
version = PlayerPrefs.GetString("version");

Debug.Log("Primera vez que instaló");
}

if (!string.Equals(version, "1.0.4"))//Different from actual version
{
//Do something
File.WriteAllText(PLAYER_PATH, JsonUtility.ToJson(playerSO));
PlayerPrefs.DeleteKey("version");
PlayerPrefs.SetString("version", "1.0.4");//Change 1.0.0 for actual version every want to update app
PlayerPrefs.Save();

Debug.Log("Primera vez que se juega (Pudo desinstalar)");
}

string json = File.ReadAllText(PLAYER_PATH);
return json;
}
User avatar
Tony Li
Posts: 22145
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue System when uninstall on android

Post by Tony Li »

Hi,

PlayerPrefs for an app are deleted when you uninstall the app unless: (1) Android is deleting as part of an app update, or (2) you're using autobackup. Since the complete save data is saved under a single key, it should be all or nothing, not possible that it deletes some variable values and not others. If variables aren't the values you expect, it's probably due to something else.
Post Reply