function creatingFolder(fileSystem) {
var entry = fileSystem.root;
entry.getDirectory("productpictures", {create: true, exclusive: false}, win, error);
window.newfolder = fileSystem.root.toURL()+"/productpictures";
}
function win(dir) {
alert("Created dir with name: "+dir.name);
alert("Created dir at: "+dir.toURL());
alert("Created dir NativePath: " + dir.nativeURL);
alert('done '+window.newfolder);
}
function error(error){
alert('hmm: '+error.code+' message: '+error.message);
}
好的,所以[productpictures]是我的應用程序將創建的文件夾,應用程序用戶可以將文件下載到此[productpictures]文件夾中。我的問題是,如何讓我的應用用戶在關閉應用後訪問此文件夾[productpictures]。現在,當我在真實的Android設備上創建該文件夾時,路徑爲:file:///data/data/com.packagename/files/files/productpictures。科爾多瓦在SD卡內部創建文件夾 - 內部或外部
那麼,有什麼方法可以在Android設備用戶即使關閉應用程序後也可以輕鬆訪問的地方創建此文件夾。我想創建這個文件夾[productpictures],如sdcard/productpictures或安卓照片庫或Android設備的下載文件夾。
我嘗試過的另一個代碼,但沒有工作;
function creatingFolder(fileSystem) {
var entry = fileSystem.root;
entry.getDirectory(cordova.file.externalRootDirectory+"/productpictures", {create: true, exclusive: false}, win, error);
window.newfolder = cordova.file.externalRootDirectory+"/productpictures";
}
所以,還沒有找到任何資源在線來完成這個。我想要這個功能,因爲用戶應該能夠發送或共享[productpictures]文件夾內的文件,並將此文件夾放置在像file://data/data/com.package/files/files/productpictures這樣的位置太複雜。
感謝您的幫助。