• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps [Cordova] Load file from Internal Storage

ptheg

Lurker
Hi,

is it possible to load a file with Cordova from the Internal Storage of an Android device, i.e. a file that is stored the following way:

Code:
FileOutputStream fos = openFileOutput(fileName, Context.MODE_PRIVATE);
fos.write(html.getBytes());
fos.close();

In JS I have tried to access the directory as follows:

Code:
var internalStorage = "file:///data/data/myproject/files/"; // also without file://
var dirEntry = new DirectoryEntry({fullPath:internalStorage});

But it doesn't work. I got the error message: "Uncaught ReferenceError: DirectoryEntry is not defined at file:///android_asset/www/index.html:12"

Using the path as a link works:
Code:
<a href="file:///data/data/myproject/files/storedFile.html">Go to stored file</a>

Is there a way to access the internal storage?

Thank you in advance.
 
Back
Top Bottom