Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap Filetransfer.download Ripple/Chrome

Tags:

cordova

I am working on a mobile app using jquerymobile/phonegap/cordova(2.0). I try to download some files from a stream (xml) and store them locally. This behavior only appears in chrome browser, which I use for debugging (with ripple).

How do I start the chrome ? Here we go :

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security --allow-file-access-from-files --allow-file-access

I'm developing at the Mac my plist file also has also an access * and I added <feature name="http://api.phonegap.com/1.0/file"/> to my config.xml

I tried to download some pictures with following code :

function downloadImage(url,filename,use){
if(use==="thumb") {
    filename = filename + ".png";
    download(url, filename);
}return filename; }

function download(url, filename) {

//writeLog(window.appRootDir.fullPath);
ft = new FileTransfer();
ft.download(
    url,
    window.appRootDir.fullPath + "/" + filename,
    {},
    {});
}

On simulator works fine but in chrome it fails with following error :

TypeError
ripple.js:477
TypeError: Cannot call method 'download' of undefined
at n.exports.exec (chrome-extension://geelfhphabnejjhdalkjhgipohgpdnoc/ripple.js:477:26724)
at FileTransfer.download (http://localhost/~binderf/www/a4/cordova-2.2.0.js:2753:5)
at download (http://localhost/~binderf/www/a4/js/index.js:194:5)
at downloadImage (http://localhost/~binderf/www/a4/js/index.js:182:9)
at Element.<anonymous> (http://localhost/~binderf/www/a4/js/index.js:153:51)
at Function.p.extend.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:14477)
at p.fn.p.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:11151)
at Element.<anonymous> (http://localhost/~binderf/www/a4/js/index.js:145:57)
at Function.p.extend.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:14477)
at p.fn.p.each (http://localhost/~binderf/www/a4/js/jquery-1.8.2.min.js:2:11151) ripple.js:477
FileTransfer 

FileTransfer ripple.js:483
download ripple.js:483
missing exec:FileTransfer.download

an dialog popped up with the message :

FileTransfer.download

We seem to be missing some stuff :(

What is kinda cool though you can fill in the textarea to pass a json object to the callback you want to execute.

I see its undefined but I can't figure out what is really my problem. If anyone has a guess or a similar problem please any suggestion.

like image 524
user1921446 Avatar asked Dec 21 '12 13:12

user1921446


1 Answers

It's because Ripple plugin for Chrome has not implemented this feature. It will work in real environment (e.g. phone).

like image 147
krtek Avatar answered Oct 15 '22 20:10

krtek