I'm trying to move a image stored in "temp files" directory to a directory created in file system, but nothing happens, the promise doesn't return error and success, absolutely nothing happens.
The cordova file plugin was added in my app:
I debugged the app in my device with Android Studio, and I saw an error in log cat:
"Error in Success callbackId: File285873816 : TypeError: fileSystem.getFile is not a function" in source: file:///android_asset/www/cordova.js
I gave an alert to display the fileSystem object in the callback function in ng-cordova.js, and this object don't contains the getFile() function:
$window.resolveLocalFileSystemURL(path, function (fileSystem) {
alert("fileSystem " + JSON.stringify(fileSystem));
Someone can help me?
It was my mistake, in the function moveFile, I was sending the directory with the name of the file, in the moveFrom parameter in my service. The correct way is set only the directory:
$cordovaFile.moveFile(moveFrom, currentFileName, cordova.file.dataDirectory + moveTo, newFileName)
.then(function (success) {
alert("Yeah Success " + JSON.stringify(success));
}, function (error) {
alert("Fucking error " + JSON.stringify(error));
});
Cordova file could return an invalid directory error.
Thanks for your attention.