Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does getExternalFilesDir() point to in an app running in Chrome?

I've successfully got my app running in Chrome using arc welder. And having managed to identify which files hold the sqlite database and shared preferences, I've been able to copy those across to nicely replicate how the app works on my 'phone.

On the 'phone, my app can take photographs, which it stores in the path found using getExternalFilesDir(null) and it would be nice to be able to copy those over so they can be seen when using the app through Chrome. But searching around, I've been unable to work out where this is.

I can save a file (using the app's database exporter and file-chooser) to somewhere which appears as an SD card, but no file or directory under my app's directory in ~/.config/google-chrome/Default/Storage/ext which gets changed when I do the export seems to fit.

I can see the exported file's name in def/File System/primary/p/Paths/000004.log, though as that's a data file it's not giving me any clues.

Anybody know where the virtual SD card (and so externalFilesDir) might be held?

like image 742
Tony Green Avatar asked Apr 03 '15 19:04

Tony Green


1 Answers

By default ARC stores the external storage files to the Chrome HTML5 filesystem. Each app gets its own instance of the filesystem.

To put files into it, you can either:

  1. (On a PC only) start your app, visit "chrome://inspect/#apps" for your app, and type plugin.shell('adbd') into the javascript console for it. Then you can use the Android ADB command adb push ... to transfer the data.
  2. Or 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.
like image 73
Lloyd Pique Avatar answered Oct 26 '22 22:10

Lloyd Pique