locked
How to persist the application settings

    Question

  • Hi there,

    I'm writing a Windows 8 app which retrieves pre-config to indicate my business logic:

    e.g: my setting is "HP" then it displays the HP logo, "Acer" -> displays Acer logo.

    I would keep this setting regardless the app is removed or updated.

    Could anyone please tell me how can I do that?

    Thank you very much.

    Phuc

    Tuesday, January 22, 2013 9:27 AM

Answers

  • Hi,

    You have three possible places to storage settings, all use a key-value pair syntax to read/write:

    1. Local Settings: Are persistent through launches of your App, once you save them, unless you erase them, they will be there until the App is uninstalled. Updating your App won't touch Local Settings unless you explicitly want to do so.
    2. Roaming Settings: Much like the Local Settings, but they are synchronized among all installations of your App and have a max size of 100Kb. This means that if you install the App on your tablet and desktop, the roaming settings you store in one are transmitted to the other device (provided you use your MS account on both). Mostly used for settings that are not device specific (not resolutions or device capabilities or configurations or references to content local to the device). I believe Roaming Settings are stored almost 30 days after you uninstall an App just in case you install it again and don't want to lose those settings.
    3. Temp Settings: Mostly used for caching and performance enhacing, the user can clean them if they use the Disk Clean Up tool, so don't rely on them always being there.

    There is also the Session State which can be used, as the name indicates, to store session information, mostly used to manage Suspend states on the App life cycle.

    There is a more lengthy documentation available for more details.

    Good luck!

    Tuesday, January 22, 2013 11:51 AM

All replies

  • Hi,

    You have three possible places to storage settings, all use a key-value pair syntax to read/write:

    1. Local Settings: Are persistent through launches of your App, once you save them, unless you erase them, they will be there until the App is uninstalled. Updating your App won't touch Local Settings unless you explicitly want to do so.
    2. Roaming Settings: Much like the Local Settings, but they are synchronized among all installations of your App and have a max size of 100Kb. This means that if you install the App on your tablet and desktop, the roaming settings you store in one are transmitted to the other device (provided you use your MS account on both). Mostly used for settings that are not device specific (not resolutions or device capabilities or configurations or references to content local to the device). I believe Roaming Settings are stored almost 30 days after you uninstall an App just in case you install it again and don't want to lose those settings.
    3. Temp Settings: Mostly used for caching and performance enhacing, the user can clean them if they use the Disk Clean Up tool, so don't rely on them always being there.

    There is also the Session State which can be used, as the name indicates, to store session information, mostly used to manage Suspend states on the App life cycle.

    There is a more lengthy documentation available for more details.

    Good luck!

    Tuesday, January 22, 2013 11:51 AM
  • Thanks Ealsur for your answer.

    I would prefer local settings because I need to identify which device is using my software so Roaming Settings is not suitable for this requirement.

    Another question? Can we keep the old settings when the app is updated a new version from Apps Store?

    Thanks,

    Phuc

    Wednesday, January 23, 2013 5:14 AM
  • Your welcome. Local Settings are not erased when an update is applied to the App. Local data versioning is independent of App versioning, you can if you want and need, apply migration processes if the Local data structure changes between version 1.0 and 2.0 of your App, but if you don't, Local data won't be erased or changed during updates.
    Wednesday, January 23, 2013 11:57 AM