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

1

6

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?

Girish answered 3/4, 2015 at 19:53 Comment(1)
We have an app that unzips assets at install and moves them into place on the sdcard. These files (for example JavaScript files) are renamed things like 000035 (no suffix) under the ext directory (ext/p/03 I think) you mention above. It looks like maybe one of the ldb files or something there is faking the paths. Have you tried grepping the files in the ext directory?Test
K
4

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.
Keith answered 9/4, 2015 at 0:40 Comment(1)
Number 2 works beautifully on my Linux machine and gives me nice command-line access to everything I need. Thanks.Girish

© 2022 - 2024 — McMap. All rights reserved.