Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shared preference and clear history/data

Tags:

android

If I use sharedpreference in android to store the data locally on a device for lifetime of application (until app is uninstalled), is there a risk of losing it when user opts to "clear data" from android's -> menu-> settings->manage applications>clear data. Please advise, thanks.

like image 445
Randon Avatar asked Dec 31 '25 11:12

Randon


1 Answers

There is not a "risk" of losing anything stored this way. There is a 100% guarantee that this data will be erased if the user presses the "clear data" button for your application. If you need data to persist through this (or through an uninstall) you'll need to store it on the SD card. Do not make this decision lightly though users will likely not appreciate the fact that you are storing data on their device even after they "clear data" or uninstall your app.

like image 133
FoamyGuy Avatar answered Jan 02 '26 03:01

FoamyGuy