Home » Android » Accessing Android Environment directories in Cordova

Accessing Android Environment directories in Cordova

Posted by: admin November 1, 2017 Leave a comment

Questions:

In my Cordova app I’d like to be able to list the contents of common directories on my Android device; for example:

Documents
Downloads
Pictures

Down in Android Java-land, these guys are exposed through the Environment object. But since these are platform-specific APIs, they aren’t part of the Cordova core, and instead need to be exposed by Cordova plugins.

However, I don’t see any equivalent for these in the directories exposed by the cordova-plugin-file. Is there another plugin that exposes these? I only really need to pass them in to window.resolveLocalFileSystemURL() to list the file contents and read the files.

Answers: