0 out of 1 rated this helpful - Rate this topic

Isolated Storage Best Practices for Windows Phone

Windows Phone

March 23, 2012

This topic provides best practices and general information for using isolated storage in Windows Phone.

When an application is updated in Windows Phone Marketplace, its isolated storage folder is not touched or modified. It is your responsibility to make sure the data is migrated or transformed appropriately to work with the new version of the application.

If an application is uninstalled, the data root and everything within the store, including the isolated storage folder, is deleted.

Windows Phone applications are not restricted to a particular quota. They should make careful use of storage based on their application scenario requirements. For more information about quota API implementation, see Isolated Storage Overview for Windows Phone.

Storage resources on a phone are limited. With the ability to download applications and media, and to sync data to the phone, storage space comes at a premium. When a Windows Phone has only 10 percent of its storage space remaining, the user receives a status notification. The user can then delete pictures, music, and applications in order to create the necessary storage space. However, this is not a desirable option from the user’s perspective.

Windows Phone applications do not have an imposed quota size because the requirements for each application’s scenario are different. Also, limiting the disk size on a per-application basis can result in unfriendly user scenarios. Therefore, applications should take care to store only what's necessary for subsequent launches of the application.

The following best practices provide techniques for making prudent use of storage space on a Windows Phone:

  • Temporary data and files: If your application creates any temporary data in isolated storage, make sure that it is cleared when the data is no longer being used. This data can be in the form of media that has newer, modified copies. For example, Microsoft Internet Explorer manages a cache with a temporary files folder that can be cleared to free up more storage space. To follow this model in your application, consider creating a temporary cache folder that you can clear at regular intervals.

  • User-generated data: This can be photos from the camera application, or user-created files such as notes or documents.

    • If your application allows users to create data, they should have the option to delete the data that they create. An example is a photo application that exposes a list of photos that users can subsequently delete based on their preferences.

    • To reduce the storage footprint of your application, you can synchronize or archive data to the cloud and keep only the most relevant data. For example, Microsoft Outlook on Windows Phone keeps mail for only three days by default, and the rest is stored on the server. However, in your application, the user can modify this setting as necessary.

  • Application Data: Examples include a list of stores or shops managed by a shopping list application, or a list of words contained in a dictionary application. If your application sources data from the cloud and caches it locally, make sure that you recycle it based on what is most relevant.

When the user exits your application, Windows Phone automatically calls Save to save the IsolatedStorageSettings. If you have placed any data-bound objects in the IsolatedStorageSettings, they are saved when the user exits the application.

Note Note:

This information applies only to the IsolatedStorageSettings class, not to the IsolatedStorageFile and IsolatedStorageFileStream classes.

Did you find this helpful?
(1500 characters remaining)