i in cordova bin neu und ionischewie Datei in ionischer und cordova mit File-Transfer zum Download (nur Dateisystemfehler lesen)
i Audio-Datei vom Server
meine ionische Version herunterladen möchten: 1.7.14
meine cordova Version ist: 6.1.1
meine android-Version ist: 6 (I encrypt Modus)
hier mein Code:
$scope.DownloadFile = function (url, filename) {
var ft = new FileTransfer();
var source = encodeURI('http://' + url + filename);
var targetPath = cordova.file.documentsDirectory + filename;//change path as you need
var trustHosts = true;//optional
var options = {};//optional
ionic.Platform.ready(function() {//device prepared
ft.download(source, targetPath, function (entry) {
alert('success' + JSON.stringify(entry));
}, function (err) {
alert(url + filename);
alert(JSON.stringify(err));
}, trustHosts, options);
});
}
ich dieses Ergebnis:
{"code":1 , "source":"http://sedaban.com/sedaban/users/json/app/mobile/download/146012022293952.mp3","target":"null146012022293952.mp3","http_status":200,"body":null,"exception":"/null146012022293952.mp3:open failed: EROFS (Read-only file system)"}
Ich benutze diese cordova.file.externalRootDirectory jetzt bekomme ich das (EACCES (Berechtigung verweigert) ... und cordova.file.externalDataDirectory gib mir nichts –
@amirbaqdadi da du android Marshmalliow verwendest, musst du das verwenden neuste Version von cordova file plugin (4.2.0) wie die ältere Version hat Probleme mit dem Zugriff auf Ordner mit Android marshamallow – Gandhi