I have a problem, I tried using Cordova 3.3.0, and when I use the sample code in the document, I have error type 3 each time. I deploy on Android 4.1.2. The resolution in the manifest is good for the Internet and recording external storage. The device is connected to the Internet. Plugins are loading. I do not know what I did wrong. Thank you for your help.
Here is my code:
(JavaScript):
function start() {
var fileTransfer = new FileTransfer();
var uri = encodeURI("http://3.bp.blogspot.com/-nc_F5M4_KtY/UhjPnzjacNI/AAAAAAAAAtA/UGGpjdTLT38/s1600/lapin.jpg");
fileTransfer.download(
uri,
"/sdcard/testCordova/file.png",
function(entry) {
alert("download complete: " + entry.fullPath);
},
function(error) {
alert("download error source " + error.source);
alert("download error target " + error.target);
alert("upload error code" + error.code);
},
true,
{
headers: {
Connection: "close"
}
}
);
(HTML):
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<script src="cordova.js"></script>
<script src="map.js"></script>
<script>
function onBodyLoad() {
document.addEventListener("deviceready", start, false);
}
</script>
</head>
<body onload='onBodyLoad();'>
<div id="basicMap" class="left"></div>
<div id="form" ></div>
</body>
source
share