secure-preferences icon indicating copy to clipboard operation
secure-preferences copied to clipboard

Empty SecurePreferences

Open gafful opened this issue 8 years ago • 4 comments

Anytime the app goes to the background, it looses the SecurePreferences object. And when a new one is created with the same key as was used to create initially, the object becomes available and everything works fine. But after a while, sometimes, when creating (re-initializing) the SecurePreferences object, the file gets renamed to com.package.name_preferences somehow, and a new file is created. So when a query is made it always returns the default value since the file is empty. So now there'll be 2 files. I monitored with the Android Device Monitor. A workaround is to check if empty then get the other file instead.

gafful avatar Apr 01 '16 15:04 gafful

Thanks for reporting this, I'll look into

scottyab avatar May 17 '16 07:05 scottyab

Hopefully this gets resolved

peterbetos avatar Jul 06 '16 01:07 peterbetos

@peterbetos could you please tell me how and when it gets solved? The problem exists in version 0.1.4. Is the problem solved in the master branch? Thank you for your feedback.

zecatman avatar Jan 23 '17 13:01 zecatman

one issue i found was in following method after doing handlePasswoordChange

private SharedPreferences getSharedPreferenceFile(Context context, String prefFilename) {
        this.sharedPrefFilename = sharedPrefFilename ;

this caused the filename to be null and created new pref file. needs to be

private SharedPreferences getSharedPreferenceFile(Context context, String prefFilename) {
        this.sharedPrefFilename = prefFilename;

macdonaldj avatar Sep 20 '17 17:09 macdonaldj