Open AE0011 opened 3 years ago
I have an issue. I am downloading a video file that is downloading to all other folders for example Downloads, Music, but through an error.
unsupported path /storage/emulated/0/VideoDownloader/TikTok/TIKTOKVIDEO .
` const normaldownload = dispatch => async (url, foldername , name_prefix) =>{
let mydirs = RNFetchBlob.fs.dirs.SDCardDir
var date = new Date()
let checkdir = await RNFetchBlob.fs.isDir(`${mydirs}/VideoDownloader/${foldername}`);
if(!checkdir){
RNFetchBlob.fs.mkdir(`${mydirs}/VideoDownloader/${foldername}`).then((res) =>{
console.log('created', res)
}).catch((error) =>{
console.log('Error', error)
})
}else{
console.log("Dir existss")
}
try{
let options = {
fileCache: true,
addAndroidDownloads : {
useDownloadManager :true, // setting it to true will use the device's native download manager and will be shown in the notification bar.
notification : true,
mime : 'video/mp4',
description : 'Downloading Video',
path: mydirs+`/VideoDownloader/${foldername}/${name_prefix}`+Math.floor(date.getTime() + date.getSeconds() / 2) + '.mp4', // this is the path where your downloaded file will live in
}
}
PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,{
title: "Storage",
message: "This app would like to store some files on your phone"
}).then( async () => {
RNFetchBlob.config(options).fetch('GET', url).then((res) => {
console.log('path of the downloads ')
ToastAndroid.showWithGravityAndOffset(
`File Saved in VideoDownloader/${foldername}😃 `,
ToastAndroid.LONG,
ToastAndroid.BOTTOM,
25,
50
)
}).catch((error) =>{
console.log(error,'ERRRROR')
ToastAndroid.showWithGravityAndOffset(
`Download Failed`,
ToastAndroid.LONG,
ToastAndroid.BOTTOM,
25,
50
);
})
})
}
catch(error){
console.log("Error in catch " , error)
}
}
`
The above code WOrking fine on android 9 ad less but it through Error on android 10.
I have already added this line.
android:requestLegacyExternalStorage="true"
Still no improvement.
@AE0011 Did you find any solution? Please Suggest a solution. Thank you in advance!
Anyone have any update on this? Currently I got a task to make a file in SD Card, already tried RNFetchBlob.fs.dirs.SDCardApplicationDir and RNFetchBlob.fs.dirs.SDCardDir but it's not working properly because didn't get the correct SD Card file path.
Already setting up the Android permissions as well.
+1
I want to store/move my files to external storage(SD Card) firstly I want to check if there is any sdCard or not then I have tested with a android phone with sdCard but none of dirs are path of sdCard! Im using last version of this library.