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.
Asked
Active
Viewed 40 times
0
-
What do you mean by "some settings"? – Kevin Robatel Jul 21 '16 at 06:02
-
preferences to be precise – user3548321 Jul 21 '16 at 06:03
-
1I don't understand, can you post some example code of change? Do you talk about SharedPreferences? – Kevin Robatel Jul 21 '16 at 06:04
-
Yes you're right. sharedprefernces – user3548321 Jul 21 '16 at 06:06
-
2If you update your app then SharedPreferences value will be there, it won't be clear... – Niranj Patel Jul 21 '16 at 06:06
-
Oh it means sharedprefernces value wont change after update? So, when a new user installs the app from google play, preferences from the latest apk will be used. Am i right? – user3548321 Jul 21 '16 at 06:07
-
simply saying, even after update, old users will have the same old preferences. New users will get new preference. Thanks a lot for the help – user3548321 Jul 21 '16 at 06:09
-
@user3548321 you can check this answer . create common class for `SharedPref` .http://stackoverflow.com/questions/23024831/android-shared-preferences-example/29363541#29363541 – IntelliJ Amiya Jul 21 '16 at 06:18
2 Answers
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();

esmail jamshidiasl
- 128
- 8
0
SharedPreferences is application specific, i.e. the data is lost when you perform one of the options:
- once you uninstall the application
- 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:

ישו אוהב אותך
- 28,609
- 11
- 78
- 96