Add the following dependency to your module-level build.gradle implementation "androidx.security:security-crypto:1.0.0-rc03" The existing implementation of PreferenceManager.java The new implementation with EncryptedSharedPreferences Add below methods to PreferenceManager.java which transfers all the existing prefs to encrypted shared prefs. Call migrateToEncryptedSharedPreferences() on app start to perform migration from SharedPreferences to EncryptedSharedPreferences.