6
どういうわけか、次のように設定しようとすると「エラーコード5」が表示され続けます。 私がやりたいことは、アンドロイドのアセットからAndroidデバイスのアクセス可能な場所に既存のファイルをコピーして、他のアプリ(メールなど)で共有できるようにすることです。ここでCordova:Cordovaを使用してAndroidでファイルをコピーできません
は、私のコードの例です:
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
var storagefolder = cordova.file.dataDirectory;
var storagefolderpointer;
console.log("storage folder: " + storagefolder);
// Check for support.
if (window.requestFileSystem) {
console.log("filesystem beschikbaar");
var getFSfail = function() {
console.log('Could not open filesystem');
};
var getFSsuccess = function(fs) {
var getDIRsuccess = function (dir) {
console.debug('Got dirhandle');
cachedir = dir;
fileurl = fs.root.fullPath + '/' + storagefolder;
storagefolderpointer = dir;
};
var getDIRfail = function() {
console.log('Could not open directory');
};
console.debug('Got fshandle');
FS = fs;
FS.root.getDirectory(storagefolder, {create:true,exclusive:false}, getDIRsuccess, getDIRfail);
};
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, getFSsuccess, getFSfail);
setTimeout(function() {
console.log("directory beschikbaar");
var suc = function(entry){
var goe = function(){
console.log("copy success");
};
var fou = function(){
console.log("copy NOT NOT success");
};
entry.copyTo(storagefolder, "vcard.vcf", goe, fou);
};
var fai = function(e){
console.log("fail getFile: " + e.code);
};
window.resolveLocalFileSystemURL(storagefolderpointer + "www/visitekaart/vcard.vcf", suc, fai);
}, 1000);
} else {
console.log("filesystem NOT NOT NOT available");
}
[この問題](https://github.com/driftyco/ng-cordova/issues/506)に関連していますか? 10番目のコメント – lifeisfoo
を参照してくださいfilechooserを使ってみましたか? https://github.com/MaginSoft/MFileChooser –
エラーは、ドキュメントのhttps://github.com/apache/cordova-plugin-fileのように 'ENCODING_ERR'ですので、関連するかもしれない質問にそれを明記してください。 –