I am making an Android app, and I will do some process at the first launch of the app.After the first launch I will not these process again. So, for doing this, I want to use SharedPrefences. How long does it save data? When and how does its saved datas remove?
Asked
Active
Viewed 2,015 times
4
-
Possible duplicate of [Android SharedPreference security](https://stackoverflow.com/questions/9244318/android-sharedpreference-security) – ADM Jul 03 '18 at 14:23
-
@ADM it's not about SharedPrefernces security – Dima Kozhevin Jul 03 '18 at 14:26
-
Read the answers in link first if you are not satisfied, then comment here. – ADM Jul 03 '18 at 14:28
-
https://stackoverflow.com/questions/16566428/when-are-sharedpreferences-deleted – Blackbelt Jul 03 '18 at 14:29
-
SP will be deleted on clear data and app uninstallation . – ADM Jul 03 '18 at 14:30
3 Answers
5
Data in SharedPrefences is saved until the user uninstalls the app, or clears the app cache

Petruceli.L
- 96
- 2
2
Data in SharedPrefences is saved as file in your app internal storage, its be removed in case:
unInstall app
clear you app data
call
yourSharedPreferences.edit().clear().apply()
hope this helps

GianhTran
- 3,443
- 2
- 22
- 42
-1
When you clear the cash memory form settings all the information will be deleted and start fully new. so it not exactly that you need to uninstall your app.
So sharedpreferences is basically store data in primitive way which mean it doesn't contain data directly instead it's reference.

Hamza Rahman
- 664
- 7
- 19