Using the App File Explorer to see your app data

Windows

Windows
The Universal Windows Platform (UWP) provides several ways to save data for your app on the device, both
Please, Log in or Register to view URLs content!
and
Please, Log in or Register to view URLs content!
. Often, your app drives quite a bit of behavior off of this data, whether it’s a saved game file, some cached resources, or a settings file. Diagnosing issues with this data can be difficult when the data is out of reach though, which is why Windows Device Portal has added a File Explorer for your sideloaded apps.

This blog post will explore a new tool added to Device Portal in the Anniversary Update (AU), the App File Explorer. Using it, you can download, delete, and rename files in your app’s local data, and upload files as well. If this sounds familiar to the fantastically useful
Please, Log in or Register to view URLs content!
(ISE) from Windows Phone 8.1, you’re spot on, except that this now works in a web browser and across all Windows 10 AU devices.

Please, Log in or Register to view URLs content!

Yes, those first two go where you think they do.


If all of this sounds new, you can check out the blog posts from last month on getting started with local and roaming data. It’s a powerful way to store data for your app and ensure a seamless experience across devices with your app.

Web UI


To access this data, you’ll first want to enable Device Portal on your phone (or any other Windows 10 AU device). These directions are for mobile, but you can see full directions on
Please, Log in or Register to view URLs content!
.

  1. Head to the Settings App > Updates and Security > For Developers, and enable Developer Mode and Device Portal.
  2. Type the IP address displayed below the Device Portal options into your favorite web browser.
    • Make sure you’re on the same network, otherwise your browser won’t be able to find your phone.
    • You’ll also need to authenticate yourself with the device.
  3. Make sure you’ve got an app sideloaded (or sideload one now using the “Apps” page).
  4. Click on “File Explorer” to see the tool above.

From the File Explorer tool, you’ll see a few things – folders for your Camera pictures, your Documents, and LocalAppData, where your app stores its local data. Click on LocalAppData to see a listing of your sideloaded apps:

Please, Log in or Register to view URLs content!


From here, you can click on any of the folders present to look through the files your app has stored.

Please, Log in or Register to view URLs content!


There are a bunch of different folders that your app can store data in. The most interesting ones are LocalCache, LocalState, TempState, and RoamingState.

For a quick mapping of code to folders:

In Code (
Please, Log in or Register to view URLs content!
.Current.*) In Device Portal
Please, Log in or Register to view URLs content!
LocalCache
Please, Log in or Register to view URLs content!
LocalState
Please, Log in or Register to view URLs content!
TempState
Please, Log in or Register to view URLs content!
RoamingState

Note: While the Settings folder contains both LocalSettings and
Please, Log in or Register to view URLs content!
, Device Portal doesn’t support editing of the .dat files contained within. If that’s something you’d like to see supported, let us know on our
Please, Log in or Register to view URLs content!
and we’ll try to make it happen.

From each of these folders, you can interact with the files and folders you’ve created.

Please, Log in or Register to view URLs content!


The File Explorer currently allows you to edit the name of a file (handy for quickly switching between saved games, for example) download or upload files, and delete them. Uploading a file with the same name as an existing file will overwrite it.

REST APIs


Because the App File Explorer is a Device Portal tool, everything you see happening in the Web UI can be reproduced using just the REST APIs. For an easy example of this, you can type this route into your browser: /api/filesystem/apps/files?knownfolderid=CameraRoll , which will produce a JSON record of all files in your CameraRoll folder.

You can see complete documentation of the REST APIs on
Please, Log in or Register to view URLs content!
. Using the REST APIs you can…

  • Get a list of “known folders” that the tool can access.
  • List files and folders for a sideloaded app or known folder.
  • Delete a file.
  • Upload a file.
  • Download a file.
  • Rename a file.

Between these APIs, you can construct an end-to-end pipeline to quickly swap out different parts of your app’s data to test user settings, verify backwards compatibility, or quickly get an app set up for demo purposes. If you find a cool use for these or any other Device Portal features, we’d love to hear about it in the comments!

Related Information


Written by Hirsch Singhal, Program Manager for the Developer Ecosystem and Platform.

Please, Log in or Register to view URLs content!
 

Users who are viewing this thread

Top