The story of state: AppData, settings, and the process lifecycle

Sign in to queue

Description

Windows Store apps are intended to be stateful, meaning that the user receives them with meaningful content already in place, even on first launch, across sessions, and across devices. Taking the point of view of the state itself, this session explores where that state lives, the different ways it's created and modified, and how it fulfills its purpose of supporting stateful apps.
For more information, check out this course on Microsoft Virtual Academy:

Day:

2

Code:

3-126

Room:

B33 Baker

Embed

Download

Download this episode

For more information, check out this course on Microsoft Virtual Academy:

The Discussion

  • User profile image
    Sempf

    There aren't many people on the planet who understand the underpinnings of WinJS better than Kraig. Very informative talk.

  • User profile image
    Alex

    How does the state managed across app updates/deletes/reinstalls? What stays and what is deleted?

  • User profile image
    gcowin

    Great session Kraig. State a great thread that brings together different API's and considerations. Enjoyed it.

  • User profile image
    KraigB

    Good question, Alex. Local and roaming app state is preserved across app updates. As I discuss in the talk, if you change the version number of the app data (as opposed to the version of the app), you use Windows.Storage.ApplicationData.SetVersionAsync to indicate that. The version applies to local/temp/roaming state as a whole.

    If you uninstall the app, local and temp state is wholly deleted (the folders in appdata for your package are deleted). Roaming state will remain in the cloud for "a reasonable time" so it's still there if you reinstall the app. The time is something like a month, but there's no particular guarantee of the timeframe. But it will be there. This is to accommodate cases where you uninstall the app from a device and then reinstall or install on another device (e.g. you buy a new device, you clean off and sell your other one, then set up the new one).

    Do note that if your roaming state is greater than the quota such that it *hasn't* been roamed, then it gets deleted along with everything else and there won't be present in the cloud.

    .Kraig

  • User profile image
    Rohit

    This has to be by far the best session.

Add Your 2 Cents