Emilio Pastore
Emilio Pastore

Reputation: 55

Where to persist temporary data in Windows 10 IoT UWP

What is the right place for my Windows 10 IoT UWP app to persist temporary working data considering the device is occasionally turned off ? I have been researching about saving files on the SD card and reading from it, but it's been tough. Not even the code below is running, for the line IReadOnlyList<StorageFile> files = await folder.GetFilesAsync(); is causing the task to abort without raising any error. It's VS 2015 on Raspberry Pi 2.

public async void pop()
{
    StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolder;
    IReadOnlyList<StorageFile> files = await folder.GetFilesAsync();
    foreach (StorageFile sf in files)
    {
        if (sf.Name.EndsWith(".mtk"))
        {
            var file = await folder.GetFileAsync(sf.Name);
            var readFile = await Windows.Storage.FileIO.ReadTextAsync(file);
            nextFileContents = readFile.ToString();
            break;
        }
    }
}

Upvotes: 2

Views: 1214

Answers (1)

Mauro
Mauro

Reputation: 1

If you read Microsoft Documentation about access uSD on Windows 10 (here link) you have to do two tasks:

  1. specify the removableStorage capability in the app manifest file and
  2. register to handle the file extensions associated with the type of media that you want to access

read the documentation and enjoy

Upvotes: 0

Related Questions