Add the following dependency to your module-level build.gradle

implementation ""

The existing implementation of

The new implementation with EncryptedSharedPreferences

Add below methods to which transfers all the existing prefs to encrypted shared prefs.

Call migrateToEncryptedSharedPreferences() on app start to perform migration from SharedPreferences to EncryptedSharedPreferences.


Make sure once the migration is completed successfully keep some pref which will indicate whether migration is pending or completed in order to avoid executing migration each time app starts.