Я зашифровал мои настройки, как это
public void setFile(){
String masterKeyAlias = null;
try {
masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC);
} catch (GeneralSecurityException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
encryptedSharedPreferences = EncryptedSharedPreferences.create(
"secret_shared_prefs",
masterKeyAlias,
this,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
);
} catch (GeneralSecurityException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
, и я устанавливаю и получаю такие значения
prefEditor.putString(SettingsActivity.KEY_NICKNAME,nickName.getText().toString()).apply();
nickname = encryptedSharedPreferences.getString(SettingsActivity.KEY_NICKNAME, "");
Все в порядке, но он не устанавливает значения в настройках, когда я открываю настройки, потому что он использует стандартный файл SharedPreferences xml.
Итак, главный вопрос: как настроить значения из Encrypted SharedPreferences вместо файла sharedpreferences xml file?