lomza
lomza

Reputation: 9706

Android SharedPreference lifecycle

In my application I have a few SharedPreference values. The mode is PRIVATE (0), so these preferences are in bounds of application. What I'm interested in, is are they removed after de-installation of the application? Or they still stay somewhere in the system until clear() will be called? Thanks.

Upvotes: 9

Views: 7033

Answers (3)

Aashish Kumar
Aashish Kumar

Reputation: 2879

SharedPreference will be deleted only:

  1. When the user uninstalls the app.
  2. When the user clears the app data through Settings > Apps.

Upvotes: 1

Jong
Jong

Reputation: 9115

SharedPreferences count as your application data, which is deleted when the app is uninstalled. I don't think you can force the device to keep them.

Upvotes: 2

Konstantin Pribluda
Konstantin Pribluda

Reputation: 12367

Deinstalation shall remove shared preferences. APK update preserves them

Upvotes: 8

Related Questions