0

Running into a really weird issue. My old SharedPreferences file is still on my phone after uninstall, and it's starting to cause issues when testing my app since it tries to load old values.

I can run preferences.clear(); on launch, then my app works, but if I then re-install the app and run it without the clear(), it loads the old (from several weeks ago) preferences file again, and causes the same errors once again.

I wrote a method to read whats in the pref-file and I can see some values in there I havent used for several weeks in testing. Why are they still alive? how do I get rid of this file?!

Green_qaue
  • 3,561
  • 11
  • 47
  • 89

1 Answers1

2

You should add to your manifest:

<application ...
   android:allowBackup="false">
...
</application>

As Maher Abuthraa sais here :

since android-23 by default backup as a task stores app's data including preferences to cloud. Later when you uninstall then install newer version you are probably going to use restored preferences.

Community
  • 1
  • 1
Dejvid
  • 470
  • 2
  • 13