Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions hub/apps/design/app-settings/store-and-retrieve-app-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ Use files to store binary data or to enable your own, customized serialized type
## Storing app data in the app data stores


When an app is installed, the system gives it its own per-user data stores for settings and files. You don't need to know where or how this data exists, because the system is responsible for managing the physical storage, ensuring that the data is kept isolated from other apps and other users. The system also preserves the contents of these data stores when the user installs an update to your app and removes the contents of these data stores completely and cleanly when your app is uninstalled.
When an app is installed, the system gives it its own per-user data stores for settings and files. You don't need to know where or how this data exists, because the system is responsible for managing the physical storage, ensuring that the data is kept isolated from other apps and other users. The system generally preserves the contents of these data stores when the user installs an update to your app, though [RoamingSettings may not persist through Microsoft Store updates](#roaming-data). For reliable data persistence through app updates, use LocalSettings instead. The system removes the contents of these data stores completely and cleanly when your app is uninstalled.

Within its app data store, each app has system-defined root directories: one for local files, one for roaming files, and one for temporary files. Your app can add new files and new containers to each of these root directories.

## Local app data


Local app data should be used for any information that needs to be preserved between app sessions and is not suitable for roaming app data. Data that is not applicable on other devices should be stored here as well. There is no general size restriction on local data stored. Use the local app data store for data that it does not make sense to roam and for large data sets.
Local app data should be used for any information that needs to be preserved between app sessions and is not suitable for roaming app data. Data that is not applicable on other devices should be stored here as well. There is no general size restriction on local data stored. Use the local app data store for data that it does not make sense to roam and for large data sets. Local app data reliably persists through app updates, making LocalSettings the recommended choice for storing user preferences and app state that must survive Microsoft Store updates.

### Retrieve the local app data store

Expand Down Expand Up @@ -152,6 +152,9 @@ async void ReadTimestamp()
>
> The following documentation applies to Windows 10 versions 1909 and lower.

> [!IMPORTANT]
> RoamingSettings data may not persist through Microsoft Store app updates. For settings that must survive app updates, use [LocalSettings](/uwp/api/windows.storage.applicationdata.localsettings) instead of RoamingSettings.

If you use roaming data in your app, your users can easily keep your app's app data in sync across multiple devices. If a user installs your app on multiple devices, the OS keeps the app data in sync, reducing the amount of setup work that the user needs to do for your app on their second device. Roaming also enables your users to continue a task, such as composing a list, right where they left off even on a different device. The OS replicates roaming data to the cloud when it is updated, and synchronizes the data to the other devices on which the app is installed.

The OS limits the size of the app data that each app may roam. See [**ApplicationData.RoamingStorageQuota**](/uwp/api/windows.storage.applicationdata.roamingstoragequota). If the app hits this limit, none of the app's app data will be replicated to the cloud until the app's total roamed app data is less than the limit again. For this reason, it is a best practice to use roaming data only for user preferences, links, and small data files.
Expand Down
4 changes: 2 additions & 2 deletions uwp/get-started/settings-learning-track.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ The following data types can be used with settings: integers, doubles, floats, c

Here are the main APIs you need to know about to save or load app settings:

- [Windows.Storage.ApplicationData.Current.LocalSettings](/uwp/api/Windows.Storage.ApplicationData#Windows_Storage_ApplicationData_LocalSettings) gets the application settings container from the local app data store. Settings stored here are kept on the device.
- [Windows.Storage.ApplicationData.Current.RoamingSettings](/uwp/api/windows.storage.applicationdata.roamingsettings#Windows_Storage_ApplicationData_RoamingSettings) gets the application settings container from the roaming app data store. Settings stored here no longer roam (as of Windows 11), but the settings store is still available. The recommended replacement for RoamingSettings is [Azure App Service](/azure/app-service/). Azure App Service is widely supported, well documented, reliable, and supports cross-platform/cross-ecosystem scenarios such as iOS, Android and web.
- [Windows.Storage.ApplicationData.Current.LocalSettings](/uwp/api/Windows.Storage.ApplicationData#Windows_Storage_ApplicationData_LocalSettings) gets the application settings container from the local app data store. Settings stored here are kept on the device and reliably persist through app updates.
- [Windows.Storage.ApplicationData.Current.RoamingSettings](/uwp/api/windows.storage.applicationdata.roamingsettings#Windows_Storage_ApplicationData_RoamingSettings) gets the application settings container from the roaming app data store. Settings stored here no longer roam (as of Windows 11), but the settings store is still available. **Important**: RoamingSettings may not persist through Microsoft Store app updates; use LocalSettings for data that must survive updates. The recommended replacement for RoamingSettings is [Azure App Service](/azure/app-service/). Azure App Service is widely supported, well documented, reliable, and supports cross-platform/cross-ecosystem scenarios such as iOS, Android and web.
- [Windows.Storage.ApplicationDataContainer](/uwp/api/windows.storage.applicationdatacontainer) is a container that represents app settings as key/value pairs. Use this class to create and retrieve setting values.
- [Windows.Storage.ApplicationDataCompositeValue](/uwp/api/Windows.Storage.ApplicationDataCompositeValue) represents multiple app settings that should be serialized as a unit. This is useful when one setting shouldn't be updated independently of another.

Expand Down