Consents remain when restarting app
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?
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)
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.