cordova - Phonegap FileTransfer appears to do nothing in android -
i'm having problems phonegap filetransfer api. i'm trying run example code below:
savefile: function (filepath,location, filetype) { console.log("function being called"); var self = this; //filepath path internets file //location on device file stored var filetransfer = new filetransfer(); filetransfer.download(filepath,self.rootpath + location + '.' + filetype, function (entry) { console.log('############# download works ##############'); console.log("download complete: " + entry.fullpath); }, function (error) { console.log('############# download fails ##############'); console.log("download error source " + error.source); console.log("download error target " + error.target); console.log("upload error code" + error.code); } ) }
currently, nothing @ appears happening. no errors flagged, , callbacks don't appear firing. initial console.log of "function being called".
i've double checked, , can confirm i'm including cordova js file, (cordova-2.4.0.js
).
if matters, i've tried on android emulator, htc 1 x , samsung galaxy s3, same results.
does know causing this?
edit: felt should mention it's running in angular js app well.
this how doing in project
document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() { window.requestfilesystem(localfilesystem.persistent, 0, gotfs, fail); } function gotfs(filesystem) { window.filesystem = filesystem; //create directory test_app filesystem.root.getdirectory("test_app", { create : true, exclusive : false }, dirwallpaper, fail); function fail(evt) { } function dirwallpaper(entry) { //save directory path window.testdir = entry; } //now download file location savefile: function (filepath,location, filetype) { console.log("function being called"); var self = this; //filepath path internets file //location on device file stored var filetransfer = new filetransfer(); var path = window.testdir.fullpath + "/test_pdf."+ filetype; filetransfer.download(filepath,path, function (entry) { console.log('############# download works ##############'); console.log("download complete: " + entry.fullpath); }, function (error) { console.log('############# download fails ##############'); console.log("download error source " + error.source); console.log("download error target " + error.target); console.log("upload error code" + error.code); } ) }
try , let me know.
Comments
Post a Comment