,

Understanding Managed Storage

In Windows Phone, apps do not have direct access to the underlying file system and must instead use a managed storage API. This helps to prevent unauthorized access to files by other apps.

Managed storage for Windows Phone works in much the same way as isolated storage in Silverlight for the browser. There is, however, no quota imposed on how much data can be stored on the phone; you are limited only by the storage capacity of the device. There is also no user-specific storage area as there is for the browser; each app has only one local folder assigned to it when it is installed.

Although the relaxation of the storage quota may appear convenient, it comes with the added responsibility of respecting the needs of your users and not consuming space unnecessarily. Phone users generally like to install new apps, download media from the Internet, and sync media to the phone from a PC. This means that storage on the device can be filled up quickly.

When a Windows Phone has only 10% of storage space remaining, the user receives a notification. The user then has the option to delete pictures, music, and apps to recover the necessary storage space. Reaching this point is not favorable from the user’s perspective.

To minimize the amount of isolated storage space that your app uses, adhere to the following points:

Image If your application creates temporary files, delete them when they are no longer needed.

Image Allow users to delete data that they have created.

Image Consider using the cloud to store data when the phone is connected to a LAN.

Image Trim application data periodically. For example, if your app caches a list of products, periodically remove items that have been in the list the longest.


Note

If an app is uninstalled, its local folder is deleted.

When an app is updated in the Marketplace, its local folder is left untouched. It is your responsibility to ensure that any data saved in the local folder is transformed to be compatible with the new version of your application.


Besides being able to read and write files in the local folder, the isolated storage API also provides a managed dictionary for saving app settings (see Figure 28.1).

Image

FIGURE 28.1 Logical representation of an application’s isolated storage area.

This managed dictionary is the IsolatedStorageSettings class, discussed later in the chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.22.162