{"id":5721,"date":"2014-04-06T10:29:26","date_gmt":"2014-04-06T10:29:26","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/06\/using-filetransfer-api-for-phonegap-on-android-download-fails-collection-of-common-programming-errors\/"},"modified":"2014-04-06T10:29:26","modified_gmt":"2014-04-06T10:29:26","slug":"using-filetransfer-api-for-phonegap-on-android-download-fails-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/06\/using-filetransfer-api-for-phonegap-on-android-download-fails-collection-of-common-programming-errors\/","title":{"rendered":"Using FileTransfer API for Phonegap on Android download fails-Collection of common programming errors"},"content":{"rendered":"<p>I am trying to implement the FileTransfer API for my Phonegap App in Javascript. When I call it with the code below I get the following error:<\/p>\n<pre><code>01-24 00:36:10.495: I\/Web Console(14802): Error: SyntaxError: Unexpected identifier at file:\/\/\/android_asset\/www\/js\/phonegap-1.3.0.js:670\n<\/code><\/pre>\n<p>Code to call download<\/p>\n<pre><code>var fileTransfer1 = new FileTransfer();\n\nfileTransfer1.download(\n    \"http:\/\/www.domain.com\/images\/file.png\",\n    \"\/sdcard\/file.png\",\n    function(entry) {\n        alert(\"download complete: \" + entry.fullPath);\n    },\n    function(error) {\n        alert(\"upload error code\" + error.code);\n   }\n);\n<\/code><\/pre>\n<p>I have this in my Manifest:<\/p>\n<p>I have this in my config:<\/p>\n<p>I have cordova-2.2.0.jar in my libs folder and phonegap-1.3.0.js is an included javascript. I did some debugging in phonegap-1.3.0.js and the error is in the call to prompt:<\/p>\n<p>var r = prompt(JSON.stringify(args), &#8220;gap:&#8221;+JSON.stringify([service, action, callbackId, true]));<\/p>\n<p>It is returing &#8220;29 F08 FileTransfer() sJSON error&#8221; this is passed to an eval function which of course fails. It would seem I am missing something in my setup somewhere. Any ideas?<\/p>\n<p>Thanks<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am trying to implement the FileTransfer API for my Phonegap App in Javascript. When I call it with the code below I get the following error: 01-24 00:36:10.495: I\/Web Console(14802): Error: SyntaxError: Unexpected identifier at file:\/\/\/android_asset\/www\/js\/phonegap-1.3.0.js:670 Code to call download var fileTransfer1 = new FileTransfer(); fileTransfer1.download( &#8220;http:\/\/www.domain.com\/images\/file.png&#8221;, &#8220;\/sdcard\/file.png&#8221;, function(entry) { alert(&#8220;download complete: &#8221; + [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5721","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5721","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5721"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5721\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}