1

My app is currently using

sp = PreferenceManager.getDefaultSharedPreferences(ctx);

to get the sharedpreference object. Due to some security requirements, now I need to upgrade this to use EncryptedSharedPreference provided in the android jetpack library.

What happens here is when I use EncryptedSharedPreference object I loose all the data stored in normal shared preference file.
How can I get all my data on the EncryptedSharedPreferences.

Ichigo Kurosaki
  • 3,670
  • 8
  • 37
  • 55
  • This may help you : https://stackoverflow.com/questions/30148729/how-to-secure-android-shared-preferences – haresh Jan 02 '20 at 09:58
  • That is how I have implemented it now, but how can I upgrade for existing without losing the existing data. – Ritu Srivastava Jan 03 '20 at 10:22
  • How can it be? See https://medium.com/att-israel/how-to-migrate-to-encrypted-shared-preferences-cc4105c03518. If use the same file for `SharedPreference` and `EncryptedSharedPreference`, new data will be accumulated, not clearing previous. – CoolMind Mar 22 '21 at 14:32

0 Answers0