android - Failed to download and save file in phonegap -


Hi Phonegap Lovers / Developers, demanding a strict request. True, specifically:

  window.requestFileSystem (LocalFileSystem.PERSISTENT, 0, function onFileSystemSuccess (file system) {are fileSystem.root.getFile (create "tmp.txt", {- I the following code throw error: false} function gotFileEntry (fileEntry) {var sPath = fileEntry.fullPath.replace ( "tmp.txt", ""); var fileTransfer = new fileTransfer (); fileEntry.remove (success, fail); fileTransfer.download (encodeURI (FILE_URL), sPath + "theFile.pdf", function (thefile) {console.log ( "Download complete." + theFile.toURL (), 'successful');}, failed);} , Unsuccessful);}, unsuccessful); Function failed (error) {console.log (error + ', code:' + error.code); }  

Btw, I found this fileTransfer.download that fails on the error code 2 which means the destination directory / loc is incorrect. Later I found the fileEntry.fullPath value "/" only happens on the IOS emulator, and even on my Android phone (installed and ran apk).

Instead of having LocalFileSystem.PERSISTENT, try the window.appRootDirName without any success, this seems undefined.

I want to get out of this, it became a nightmare! Appreciate your help.

Thanks Moses


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -