Android : SharedPreferences data lifetime
For example if I do it once in my application :
sharedPref.edit().putString("com.blablabla.name_user","COCORICO").apply();
Can I find the data as long as the application is installed ?
String name_user = sharedPref.getString("com.blablabla.name_user", "");
Except if I reinstall the application or if I overwrite the data,
the data will never be lost, even several months later ?
android sharedpreferences
add a comment |
For example if I do it once in my application :
sharedPref.edit().putString("com.blablabla.name_user","COCORICO").apply();
Can I find the data as long as the application is installed ?
String name_user = sharedPref.getString("com.blablabla.name_user", "");
Except if I reinstall the application or if I overwrite the data,
the data will never be lost, even several months later ?
android sharedpreferences
add a comment |
For example if I do it once in my application :
sharedPref.edit().putString("com.blablabla.name_user","COCORICO").apply();
Can I find the data as long as the application is installed ?
String name_user = sharedPref.getString("com.blablabla.name_user", "");
Except if I reinstall the application or if I overwrite the data,
the data will never be lost, even several months later ?
android sharedpreferences
For example if I do it once in my application :
sharedPref.edit().putString("com.blablabla.name_user","COCORICO").apply();
Can I find the data as long as the application is installed ?
String name_user = sharedPref.getString("com.blablabla.name_user", "");
Except if I reinstall the application or if I overwrite the data,
the data will never be lost, even several months later ?
android sharedpreferences
android sharedpreferences
asked Nov 24 '18 at 20:02
poulay1253poulay1253
145
145
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Why you think data should lost, unless you modified/deleted it?
You can read more about shared perferences here: https://developer.android.com/training/data-storage/shared-preferences
If you will uninstall application all shared perferences will be deleted. If it will be updated in correct way (signed with same keys) - not.
OK so it will not be deleted when we update the application ! cool ! thanks
– poulay1253
Nov 24 '18 at 20:09
Yes but you will need to use same keystore for all updates.
– Andrey
Nov 24 '18 at 20:13
yes i have the same keystore ! thank you Andrey
– poulay1253
Nov 24 '18 at 20:33
add a comment |
No, it won't be deleted. It will be deleted only if:
- user clears application data
- user reinstalls the application
user manually deletes SP data
SharedPreferences is made to save key values, such as settings, etc.
You can find your SP file in /data/data/you.apk.package.name/shared_prefs/
thank you for the confirmation !
– poulay1253
Nov 24 '18 at 20:10
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53461902%2fandroid-sharedpreferences-data-lifetime%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Why you think data should lost, unless you modified/deleted it?
You can read more about shared perferences here: https://developer.android.com/training/data-storage/shared-preferences
If you will uninstall application all shared perferences will be deleted. If it will be updated in correct way (signed with same keys) - not.
OK so it will not be deleted when we update the application ! cool ! thanks
– poulay1253
Nov 24 '18 at 20:09
Yes but you will need to use same keystore for all updates.
– Andrey
Nov 24 '18 at 20:13
yes i have the same keystore ! thank you Andrey
– poulay1253
Nov 24 '18 at 20:33
add a comment |
Why you think data should lost, unless you modified/deleted it?
You can read more about shared perferences here: https://developer.android.com/training/data-storage/shared-preferences
If you will uninstall application all shared perferences will be deleted. If it will be updated in correct way (signed with same keys) - not.
OK so it will not be deleted when we update the application ! cool ! thanks
– poulay1253
Nov 24 '18 at 20:09
Yes but you will need to use same keystore for all updates.
– Andrey
Nov 24 '18 at 20:13
yes i have the same keystore ! thank you Andrey
– poulay1253
Nov 24 '18 at 20:33
add a comment |
Why you think data should lost, unless you modified/deleted it?
You can read more about shared perferences here: https://developer.android.com/training/data-storage/shared-preferences
If you will uninstall application all shared perferences will be deleted. If it will be updated in correct way (signed with same keys) - not.
Why you think data should lost, unless you modified/deleted it?
You can read more about shared perferences here: https://developer.android.com/training/data-storage/shared-preferences
If you will uninstall application all shared perferences will be deleted. If it will be updated in correct way (signed with same keys) - not.
answered Nov 24 '18 at 20:06
AndreyAndrey
1,64432146
1,64432146
OK so it will not be deleted when we update the application ! cool ! thanks
– poulay1253
Nov 24 '18 at 20:09
Yes but you will need to use same keystore for all updates.
– Andrey
Nov 24 '18 at 20:13
yes i have the same keystore ! thank you Andrey
– poulay1253
Nov 24 '18 at 20:33
add a comment |
OK so it will not be deleted when we update the application ! cool ! thanks
– poulay1253
Nov 24 '18 at 20:09
Yes but you will need to use same keystore for all updates.
– Andrey
Nov 24 '18 at 20:13
yes i have the same keystore ! thank you Andrey
– poulay1253
Nov 24 '18 at 20:33
OK so it will not be deleted when we update the application ! cool ! thanks
– poulay1253
Nov 24 '18 at 20:09
OK so it will not be deleted when we update the application ! cool ! thanks
– poulay1253
Nov 24 '18 at 20:09
Yes but you will need to use same keystore for all updates.
– Andrey
Nov 24 '18 at 20:13
Yes but you will need to use same keystore for all updates.
– Andrey
Nov 24 '18 at 20:13
yes i have the same keystore ! thank you Andrey
– poulay1253
Nov 24 '18 at 20:33
yes i have the same keystore ! thank you Andrey
– poulay1253
Nov 24 '18 at 20:33
add a comment |
No, it won't be deleted. It will be deleted only if:
- user clears application data
- user reinstalls the application
user manually deletes SP data
SharedPreferences is made to save key values, such as settings, etc.
You can find your SP file in /data/data/you.apk.package.name/shared_prefs/
thank you for the confirmation !
– poulay1253
Nov 24 '18 at 20:10
add a comment |
No, it won't be deleted. It will be deleted only if:
- user clears application data
- user reinstalls the application
user manually deletes SP data
SharedPreferences is made to save key values, such as settings, etc.
You can find your SP file in /data/data/you.apk.package.name/shared_prefs/
thank you for the confirmation !
– poulay1253
Nov 24 '18 at 20:10
add a comment |
No, it won't be deleted. It will be deleted only if:
- user clears application data
- user reinstalls the application
user manually deletes SP data
SharedPreferences is made to save key values, such as settings, etc.
You can find your SP file in /data/data/you.apk.package.name/shared_prefs/
No, it won't be deleted. It will be deleted only if:
- user clears application data
- user reinstalls the application
user manually deletes SP data
SharedPreferences is made to save key values, such as settings, etc.
You can find your SP file in /data/data/you.apk.package.name/shared_prefs/
answered Nov 24 '18 at 20:06
DominDomin
457114
457114
thank you for the confirmation !
– poulay1253
Nov 24 '18 at 20:10
add a comment |
thank you for the confirmation !
– poulay1253
Nov 24 '18 at 20:10
thank you for the confirmation !
– poulay1253
Nov 24 '18 at 20:10
thank you for the confirmation !
– poulay1253
Nov 24 '18 at 20:10
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53461902%2fandroid-sharedpreferences-data-lifetime%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown