6

We have a feature in our app which can save file to ExternalStoragePublicDirectory. Below is the directory path we are using. Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);

It looks like file is getting saved in the directory. But I cant locate the saved file in Desktop or Chromebook. Can anybody please point me to right direction?

Vivek
  • 1,823
  • 1
  • 19
  • 39

1 Answers1

7

Under ARC, your external storage files are being read and written to the HTML5 filesystem. Under Chrome app (yours included) gets its own filesystem.

You can view this filesystem with Chrome (desktop or Chromebook) using some experimental developer tools. You have to enable them and then restart the browser. Here is how:

  • Visit "chrome://flags" in your browser.
  • Search for "Enable Developer Tools experiments", and click the "Enable" link.
  • A prompt to restart your browser should have appeared. Go ahead and click it to restart your browser.
  • Go ahead and launch your app. It needs to be running so that you can browse the filesystem.
  • Next visit the "chrome://inspect/#apps" page in your browser, and find your app in the list. Click the "inspect" link to bring up the inspector window.
  • Click the gear icon in the upper right of the window.
  • Click the "Experiments" tab listed on the left side of the popup. This is only visible if you enabled the experimental features at all.
  • Click the "Filesystem Inspection" checkbox to enable the filesystem viewer.
  • Finish up by closing the options page with the "x" at the top left.

Now you can view your app's filesystem.

  • From the inspector window for your app, click the "Resources" tab along the top.
  • You should see a "FileSystem" option appear in the list on the left side. Click it to expand it.
  • Click the "persistent -chrome extension:" subpanel.
  • You should be able to then navigate to the download directory by expanding the view that appears. I believe for downloads you want "/storage/sdcard/Download".

Selecting the directory will display basic metadata on all the files in the directory. Selecting the file might display it if it is supported. Or you might just get a "Binary File" message if not.

If you want to actually manipulate the data beyond that, you will need to connect with the browser with the Android adb command/shell, and you should be able to "adb pull" the file. See https://developer.chrome.com/apps/getstarted_arc#bestpractices to get going on that.

You can also add {"enableExternalDirectory": true} to your application's metadata. Enabling this option means that ARC will prompt you for the directory to use for for the external directory, and you can pick a real directory on your system to use. But if you already download a file prior to enabling this feature, you will have to download it again.

Lloyd Pique
  • 916
  • 5
  • 5
  • 1
    Where to find the list of all possible options to add in application's metadata? like, `{"enableExternalDirectory": true}` – tausiq Apr 12 '15 at 05:11
  • We have not published an official list of all the options. Sorry. – Lloyd Pique Apr 13 '15 at 21:18
  • Just for future reference to others finding this thread, the `{"enableExternalDirectory": true}` param is found in the manifest.json file for the app. You may also need `{"fileSystem": ["write", "retainEntries", "directory"]},` as well. And one more thing, you will of course have to _reload_ the app via _chrome://extensions_ after changes to the manifest file. – kgingeri Jun 08 '16 at 05:28
  • What is the "HTML5 filesystem"? – Melab Jun 28 '16 at 22:09