0

I've two apk files of same app and 1st one is an old version and 2nd apk new. There's some changes in the 2nd apk(some settings and some extra text). I updated the 1st apk with the second one, and it successfully updated. When I checked the app, I can see the new text but some settings which are changed in the new apk file remains same. Then I fully uninstalled the app and reinstalled the new apk and when I open it, I can see that everything is changed as expected(settings too). So this issue happens only when I update the app. Any idea why this is happening? ps: I wasn't trying to update via google play. Direct apk update.

user3548321
  • 443
  • 1
  • 7
  • 17

2 Answers2

1

Hi if you are using sharedpreferences in your code so it's not update.you can uninstall old version and then install new version or you must write code that clear the sharedpreferences do this with:

SharedPreferences pref = getSharedPreferences("Mypref", 0);
preferences.edit().remove("shared_pref_key").commit();
0

SharedPreferences is application specific, i.e. the data is lost when you perform one of the options:

  1. once you uninstall the application
  2. once you clear application data (through Settings)

SharedPreference store certain options persistently throughout the lifetime of the application. So when you installing the new version of the apk, the data still intact.

Read more at:

  1. Android Persistence with preferences and files - Tutorial
  2. Storing and Accessing SharedPreferences
ישו אוהב אותך
  • 22,515
  • 9
  • 59
  • 80