I tried to download .jpg file in internal memory storage using dataDirectory.
On downloading I see the image successfully message. But I don’t see the file in required directory
eg. internalstorage/android/data/myapp/files/ empty here
But same thing I tried with *externalDataDirectory * which is working fine.
eg. external storage/android/data/myapp/files/MyFile.jpg
Note: In this case I manually set the permission by going setting–> apps --> myapp–> permissions–> Storage enabled
here is the code snippet
’
downloadImage(image) {
this.platform.ready().then(() => {
const fileTransfer: TransferObject = this.transfer.create();
const url = `http://example.com/pug.jpg`;
fileTransfer.download(url,this.file.dataDirectory+ 'MyFile.jpg').then((entry) => {
const alertSuccess = this.alertCtrl.create({
title: "Download Succeeded!",
subTitle: "File was successfully downloaded to:"+this.file.dataDirectory',
buttons: ['Ok']
});
alertSuccess.present();
}, (error) => {
const alertFailure = this.alertCtrl.create({
title: `Download Failed!`,
subTitle: `File was not successfully downloaded. Error code: ${error.code}`,
buttons: ['Ok']
});
alertFailure.present();
});
});
}
’
Please let me know If I am doing wrong any where or is there any file permission issue etc. Thanks