GDPRConsent icon indicating copy to clipboard operation
GDPRConsent copied to clipboard

Consents remain when restarting app

Open OrWestSide opened this issue 6 years ago • 2 comments

When I install the app for the first time, the consents are not given. If I give them, then the Constants.KEY_CONSENT_CHANGED is fired.

But when I restart the app, and I want to give consent for another user, the consents are not reset, they are on, meaning that the Constants.KEY_CONSENT_CHANGED is not fired.

Is there any way to reset the consent fields? Or I have to check manually if every consent is given?

OrWestSide avatar Dec 16 '19 16:12 OrWestSide

I don't think so, it should be trivial to add a reset function though. You could delete all or specific consent by editing the preferences:

val prefs = context.getSharedPreferences(Constants.PREF_GDPR, Context.MODE_PRIVATE)

DavidEdwards avatar Dec 16 '19 16:12 DavidEdwards

Thank you for answering. I tried 2 approaches. The first one is this:

for (int i = 0 ; i < gdpr_list.size() ; i++){
    gdpr_list.get(i).setConsented(false);
    gdpr_list.get(i).setSeen(false);
}

but the consents are not reset. I tried using the shared preferences as you mentioned, by doing this: context.getSharedPreferences(Constants.PREF_GDPR, Context.MODE_PRIVATE).edit().commit(); I also tried with .apply() but still not any luck.

OrWestSide avatar Dec 17 '19 09:12 OrWestSide