Microsoft explains locally storing app data for Windows 10

The Windows App Team has written up yet another blog post to inform developers about their options when it comes to storing app data. The team has been focusing on building knowledge on the building blocks of app development and encouraging developers to build on and convert their applications to the Universal Windows Platform. A month ago, we even saw Microsoft’s porting guide for apps to convert from Silverlight to UWP.

The blog series has already covered roaming data and utilizing cloud providers, but this post specifically focused on the local types of data storage. What that means is the data that is stored directly in the device’s files instead of being shared multiple installations.

Developers will need to decide which type works best with their application. There are two types of app data: Files and settings. Files include the data that the application needs to store binary and custom types of data. The settings is best used for saving the app status and user preferences through a variety of data types:

  • UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, Double
  • Boolean
  • Char16, String
  • DateTime, TimeSpan
  • GUID, Point, Size, Rect
  • ApplicationDataCompositeValue — a set of related app settings that must be serialized and deserialized atomically

As most developers know, the data can be stored in three possible locations on the device: Local, LocalCache, and Temporary. The best part about data stored in the Local folder is that the information can be backed up with the App Data Backup just in case. This also means, however, that security isn’t guaranteed. Developers using the Local folder should avoid storing personal information, credentials, and data that are tied to a specific device.

Local folders can hold both files and settings. The best part about data stored in the Local folder is that the information can be backed up with the App Data Backup just in case. This also means, however, that security isn’t guaranteed. Developers using the Local folder should avoid storing personal information, credentials, and data that are tied to a specific device. Furthermore, the blog states that using the Credential Locker feature is recommended to ensure the safety of information that should remain private.

LocalCache folders will hold the data after suspension or closure of the application, but will not remain through the backup assistant. This is where developers should store authentication, credentials, and any other data that is needed across app sessions but shouldn’t be saved otherwise.

Temporary folders serve exactly the purpose of being temporary. Data in the temporary folder is best used for files that won’t be needed anymore after the application’s use. It’s also good practice to clear the temporary files when an app is initialized to minimize any storage issues.

With these options in mind, developers will be able to make a more informed decision on how exactly to store the data locally on devices. To read more into the detail of how to implement data storage, check out the official blog written by Hector Barbera from the Developer Ecosystem and Platform.

Share This
Further reading: , , ,

In what ways has the developer blogs from the Apps team helped you improve your project?