I’m try to create a folder when file download from my app on internal memory root directory like whatsapp , facebook or any others app but i did not get any solution. my file is stored in this location file:///storage/emulated/0/Android/data/my_app_name/files/abc.something
but I want to download file into my internal memory root directory .How can i do that.
I’m try to do like this below my code
download(event,item){
this.presentToast('Download started..');
this.platform.ready().then(() => {
this.storageDirectory = cordova.file.externalDataDirectory;
const fileTransfer: FileTransferObject = this.transfer.create();
let getUrl = this.selectedItem._meta_video_status
let downloadFileName = getUrl.substr(getUrl.lastIndexOf('/') + 1);
//const imageLocation = `${cordova.file.applicationDirectory}www/assets/img/${item}`;
const url = getUrl;
var URL = encodeURI(url);
this.loading = this.loadingCtrl.create({
content: 'Downloading...',
});
this.loading.present();
fileTransfer.download(URL, this.storageDirectory + downloadFileName).then((entry) => {
this.loading.dismissAll();
this.presentToast('Download complete !');
}, (error) => {
this.presentToast('Download faild, please try again !');
});
});
}
Please help me out I spent more than 20 days on it but did not get any solution.
Thanks