我想使用FileTransfer.download(),但似乎得到「錯誤代碼3」,無論我嘗試。任何幫助是極大的讚賞。android phonegap FileTransfer.download()接收錯誤代碼3
我正在使用cordova 2.1和zend studio 10,它建立在eclipe上,用於構建我的清單和apk文件。
下面是我的代碼
var fileTransfer = new FileTransfer();
fileTransfer.download(
"http://www.w3.org/2011/web-apps-ws/papers/Nitobi.pdf",
"file:///sdcard/theFile.pdf",
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);
});
下面是我的科爾多瓦xml文件
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.phonegap.example" version="1.0.0" versionCode="1">
<name>App</name>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/device"/>
<access origin=".*" />
</widget>
和我的Android的manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.phonegap.example"
android:versionCode="1"
android:versionName="1.0.0"
>
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:configChanges="orientation|keyboardHidden"
android:name=".PhonegapActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
我也曾嘗試設置的android:可調試=在我的應用程序標籤中爲「true」
任何幫助,非常感謝
保存我的日子+1 – 1Mayur