Reputation: 2472
SharedPreferences class allows to save application data in simple type (boolean, String, etc.) formats.
Normally they are not removed and they are supposed to persist, but are they removed in case such as when application is updated/removed or application cache is cleared?
Upvotes: 11
Views: 9081
Reputation: 4590
It also happens, if you force install an old app version (lower build number) on top of the current one.
Upvotes: 0
Reputation: 157437
when you do clear data
from the device applications manager
or when you uninstall your application, the SharedPreference's file is deleted.
SharePreferences are stored inside
/data/data/packagename/shared_prefs/prefsname.xml
unless you have the android:allowBackup="true"
in your manifest. In that case they might be restored.
Upvotes: 20
Reputation: 185
Sharedpreferences
will clear when you clear application data from Application manager by force.
If you want to clear your application Sharepreference data, then you can use:
PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commit();
Upvotes: 4
Reputation: 2707
Go to Setting
->Application setting
->Application
->Clear data
and force data will clear all the data of application (sqlitedatabase and shared preferences) are removed.
Upvotes: 3