4

I've stored some data in the ApplicationData.Current.RoamingSettings following the Example here http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh700362.aspx . The problem is that after storing the data in the RoamingSettings and then removing the same data using ApplicationData.Current.RoamingSettings.Values.Remove(key) (I've checked and actually the data are no more there), if I Uninstall and re-install the App on my Phone the Data I've deleted are back in RoamingSettings...

I've tried also ApplicationData.Current.ClearAsync() that clean all but after uninstalling and re-installing the app same thing.. the data are back.

Any suggestions?

Valerio
  • 278
  • 1
  • 6
  • 18

1 Answers1

4

RoamingSettings are designed to work like that. They can be used to store settings between devices. After you uninstall the App from all devices, the settings would persist in the cloud for some time in case the User installs the App again. If you want to use only local data - take a look at LocalSettings.

You will find more information about Guidlines for Roaming Data here at MSDN.

And here at the blog you will find similar answer:

Q. What happens to roaming app data when an app is uninstalled?

A. As noted in the previous question, an app’s app data folders are removed from a device when the app is uninstalled. Roaming app data, however, persists in the cloud so long as the user has the same app installed on other devices. When the user uninstalls the app from all of his or her devices, roaming app data continues to persist in the cloud for a reasonable time (a matter of a few weeks) so that it’s still available if the user decides to reinstall the app within that time. Note that when you make a change to an app project in Microsoft Visual Studio and that change (such as changing the manifest) forces a full reinstall, app data is removed as part of the process. References: Guidelines for roaming app data(overview docs).

So your to remove permanently your RoamingSettings you will have to wait.

EDIT - thanks to Pablo we have more detailed information here at MSDN:

Roaming data for an app is available in the cloud as long as it is accessed by the user from some device within the required time interval. If the user does not run an app for longer than this time interval, its roaming data is removed from the cloud. If a user uninstalls an app, its roaming data isn't automatically removed from the cloud, it's preserved. If the user reinstalls the app within the time interval, the roaming data is synchronized from the cloud. The current policy specifies that this time interval is 30 days.

Community
  • 1
  • 1
Romasz
  • 29,662
  • 13
  • 79
  • 154
  • 1
    Thank you! After your answer I checked further and found this _If a user uninstalls an app, its roaming data isn't automatically removed from the cloud, it's preserved. If the user reinstalls the app within the time interval, the roaming data is synchronized from the cloud. The current policy specifies that this time interval is 30 days._ [Reference](http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh464917.aspx#roaming_app_data) – Valerio Jun 25 '14 at 17:00
  • @Pablo Thanks for the reference. Nice to now the correct time interval. – Romasz Jun 25 '14 at 17:30
  • 1
    @Romasz There is some part i still didn't understand. If you delete a specific RoamingSetting it will "disappear", but if after that you uninstall the app and install it again it will "re-appear". Is that supposed to happen? – meneses.pt Sep 25 '14 at 11:14
  • @Meneses It seems that this may be an issue connected with cloud synchronization. Maybe once you have deleted the RoamingSettings, the app wasn't able to sync with the clud and when you have reinstalled it it downloaded the *old* settings. – Romasz Sep 25 '14 at 11:17
  • @Romasz I considered that, but I don't think it is the issue. I was saving a token when the user logged in (in my app) and if the token existed in the roamingSettings it meant the user was logged in. When the user logged out I deleted the setting. If I uninstalled and reinstalled the app the setting would be there. This happened everytime.I came up with an alternative. Instead I save a bool in roamingSettings which lets me know if the user is logged in or not. When I delete the token, I set the bool setting to false. After reinstalling the app, the token is there but the value is set to false. – meneses.pt Sep 25 '14 at 11:46
  • 2
    @Meneses So it means that the change of the setting is updated, but the setting deletion is not. It may be a desired behaviour (I'm not sure), RomaingSettings may be used among many devices. In this case I would also use additional info if the setting is set (other *bool* or an *enum*). BTW I wonder if the deleted setting will disappear after 30 days. – Romasz Sep 25 '14 at 12:02