I have a method as follows:
public static void addHighligtedDate(String date){
prefs = context.getSharedPreferences(Fields.SHARED_PREFS_FILE, 0);
Set<String> highlightedDates = prefs.getStringSet(Fields.HIGHLIGHTED_DATES, new HashSet<String>());
highlightedDates.add(date);
SharedPreferences.Editor editor = prefs.edit();
editor.putStringSet(Fields.HIGHLIGHTED_DATES, highlightedDates);
editor.commit();
}
Now the scenario is this:
When I open the app add the dates to be highlighted, they are highlighted because SharedPreferences contains the values. When I press the home button to exit the app and come back, the values are still there.
However, when the app is removed from recents, the values go away. Is this normal behavior or am I doing something wrong?
Going over the docs:
This data will persist across user sessions (even if your application is killed).