Is there a way to access the internal file storage in Windows Phone 8? I noticed that there is a way to read files from the SD card http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.storage(v=vs.105).aspx but what about the phones that don't have an SD card slot, like the Nokia Lumia 920?
问题:
回答1:
I am not sure where specifically you mean by internal storage, but there are a few locations you can access on the device.
Application Data (Formerly Isolated Storage)
This is the bread and butter location for an app to access. It is your own private location to store settings or files that you may have.
It can be accessed with:
StorageFolder localRoot = ApplicationData.Current.LocalFolder:
There is more documentation here with examples as well.
Libraries
These are common locations where apps are able to store and access media data. Accessing these requires declaring the capability for the area you are accessing and the file associations for the files you would like to see.
For example getting the camera roll folder would require the following:
In WMAppManifest:
<Capability Name="ID_CAP_MEDIALIB_PHOTO" />
The C#
StorageFolder cameraRoll = KnownFolders.CameraRoll;
There is more documentation of the different capabilities in the designer in Visual Studio. (The summaries there are easier to get a brief understanding with than the full MSDN articles.)
KnownFolders has access to all of the different locations that you can get at internally using it. Careful though, some of the locations are Windows or Phone specific, but they are all documented so you know which.