Android Shared preference wrapper than encrypts the values of Shared Preferences. It's not bullet proof security but rather a quick win for incrementally making your android app more secure.
SecurePreferences securedPreferences = new SecurePreferences(myContext, "myPassword", "myfile");
securedPreferences.handlePasswordChange("myNewPassword", myContext);
Using handlePasswordChange leads to a strange behaviour. After method call, secured preferences file myfile.xml is empty and updated preferences are written into default shared preferences file.
It does not set sharedPrefFilename attribute with parameter prefFilename. So it is null when handlePasswordChange uses it to handle shared preference instance refresh
//refresh the sharedPreferences object ref: I found it was retaining old ref/values
sharedPreferences = null;
sharedPreferences = getSharedPreferenceFile(context, sharedPrefFilename);
Consider the following code snippet
Using handlePasswordChange leads to a strange behaviour. After method call, secured preferences file myfile.xml is empty and updated preferences are written into default shared preferences file.
Problem seems to come from the following method
It does not set sharedPrefFilename attribute with parameter prefFilename. So it is null when handlePasswordChange uses it to handle shared preference instance refresh