Question

In previous versions of cordova/phonegap the URL returned by fullPath and toURL() on a file or directory returned (in Android) "file:///mnt/sdcard".

window.requestFileSystem(
    LocalFileSystem.PERSISTENT,
    0,
    function(fs){
        console.log(fs.root.fullPath);
        console.log(fs.root.toURL());
    },
    function(error){
        console.error('Failed to get file system:' + error);
    }
);

The above code using cordova 3.3.1-0.4.2 is returning:

02-20 15:56:56.746 I/Web Console(27239): / at file:///android_asset/www/js/ui.js:64
02-20 15:56:56.746 I/Web Console(27239): cdvfile://localhost/persistent/ at file:///android_asset/www/js/ui.js:65

This is fine for using cordova based functionality but if I want to pass a URL to a third party library, the URL is meaningless. (My example is I have a GPX file stored locally and I need to pass the location to an openlayers layer)

Was it helpful?

Solution

The new cdvfile protocol does not work in android 2, for this reason the method toNativeURL() has been added to 1.0.1 of the org.apache.cordova.file plugin, see https://issues.apache.org/jira/browse/CB-6106.

OTHER TIPS

actually not linked with the version of cordova but the version of the plugins. Have you looked at the release notes of the new version of the plugins?

(I must admit it's not really clear for me either for the moment)

Raymond Camden made a blog entry on the subject, maybe can you ask question there?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top