You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failed to find configured root that contains /data/data/com.android.providers.downloads/cache/filename.pdf #40
Failed to find configured root that contains /data/data/com.android.providers.downloads/cache/filename.pdf
This error occurs when I try to open a pdf I downloaded using
android.actionViewIntent(res.path(), 'application/pdf')
The file itself saves successfully to the path I presume, but I have no way to check
Also when is the ability to save to MediaStore.Download will come?
Any help would be appreciated, thanks!
I was trying to download the file in the common downloads directory of android, but I changed that to my app directory and that fixed the issue. Is it or when will it be possible to directly download to the common downloads directory?
It's currently not possible, no.
I plan on implementing a possibility to write / read to / from the Media collections in august. With this change it then should be possible to store files in the common downloads directory too
Reacted by fl-imazono, Arunim Chaudhary and Anshul Akotkar
@arunim2405 Infact I am also not able to copy file from this directory.
/data/data/com.android.providers.downloads/cache/
Even though I have permission keep failing.
Any solution how you have downloaded file to any other directory?
@arunim2405 I am sorry man but honestly I tried that as well not working.
I am not sure how it's working for you.
Are you using Expo? I am not using it.
Is there any way you can show some demo? Honestly I really appreciate your help.
I have also taken access rights before. But it keeps downloading in default directory.
@RonRadtke
I think you can breakdown this feature and it will be really helpful.
First supporting for only downlod or upload from default download directory. This will be really good enhancement.
ReactNativeBlobUtil.config({addAndroidDownloads : {useDownloadManager : true,// <-- this is the only thing requirednotification : true,path : RNFS.ExternalDirectoryPath+'/certificate.pdf',// Optional, override notification setting (default to true)//fileCache : false,title : 'Cowin Certificate downloaded',mediaScannable : true,// Optional, but recommended since android DownloadManager will fail when// the url does not contains a file extension, by default the mime type will be text/plainmime : "application/pdf",description : 'Cowin Certificate.'}}).fetch('GET',`https://cdn-api.co-vin.in/api/v2/registration/certificate/public/download?beneficiary_reference_id=${this.state.beneficiary}`,{Accept: 'application/json',"Authorization":`Bearer ${token}`,'Content-Type': 'application/json',"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"}).then((resp)=>{// the path of downloaded fileconsole.log(resp.path())android.actionViewIntent(resp.path(),'application/pdf')AlertClass.showAlert("CASAMED","Your certificate was downloaded. Check out our app more for access to customised physiotherapy plans.",[{text: "Go to Home",onPress: ()=>{this.props.navigation.navigate("HomeScreen");},},{text: "Download another Certificate",onPress: ()=>{// this.props.navigation.navigate("MyExcercise", { item, selectedDate });},style: "cancel",},]);console.log(resp)}).catch(e=>{console.log(e)})
@arunim2405 Found issue. I have given path before addAndroidDownloads.
While to make it work need to give path inside addAndroidDownloads.
Thank you so much man.
@RonRadtke Infact document contains many links which are resolving to 404. That should be also removed. If document will be clear I do think lot's of developer's will find it helpful.
The documentation for sure could use a clean up. You're right about that.
The link you posted is not linking to the correct url.
And it is correct that the path is outside in this example.
The outer path is only used if you don't use the addAndroidDownloads, if you're using the DonwnloadManager you need to specify the path within the addAndroidDownloads section.
Activity
RonRadtke commentedon Jun 19, 2021
To which directory are you saving the file?
Looks like it is outside of your apps private directories
arunim2405 commentedon Jul 3, 2021
I was trying to download the file in the common downloads directory of android, but I changed that to my app directory and that fixed the issue. Is it or when will it be possible to directly download to the common downloads directory?
RonRadtke commentedon Jul 3, 2021
It's currently not possible, no.
I plan on implementing a possibility to write / read to / from the Media collections in august. With this change it then should be possible to store files in the common downloads directory too
Kamani commentedon Jul 8, 2021
@arunim2405 how you saved file to your app directory?
arunim2405 commentedon Jul 8, 2021
@Kamani
I was also using import RNFS from'react-native-fs';
so in my path I just used
path : RNFS.ExternalDirectoryPath +'/certificate.pdf',
Kamani commentedon Jul 13, 2021
@arunim2405
I tried to save file directly as you mentioned path : RNFS.ExternalDirectoryPath +'/certificate.pdf',.
`
ReactNativeBlobUtil.config({
But it keeps saving file in /data/data/com.android.providers.downloads/cache/
Any Idea?
Kamani commentedon Jul 13, 2021
@arunim2405 Infact I am also not able to copy file from this directory.
/data/data/com.android.providers.downloads/cache/
Even though I have permission keep failing.
Any solution how you have downloaded file to any other directory?
arunim2405 commentedon Jul 13, 2021
You seem to have missed '/' in '/receipt.pdf'
Kamani commentedon Jul 14, 2021
@arunim2405 I am sorry man but honestly I tried that as well not working.
I am not sure how it's working for you.
Are you using Expo? I am not using it.
Is there any way you can show some demo? Honestly I really appreciate your help.
I have also taken access rights before. But it keeps downloading in default directory.
Kamani commentedon Jul 14, 2021
@RonRadtke
I think you can breakdown this feature and it will be really helpful.
First supporting for only downlod or upload from default download directory. This will be really good enhancement.
arunim2405 commentedon Jul 14, 2021
arunim2405 commentedon Jul 14, 2021
@Kamani Here is the full logic I am using.
Kamani commentedon Jul 14, 2021
@arunim2405 Found issue. I have given path before addAndroidDownloads.
While to make it work need to give path inside addAndroidDownloads.
Thank you so much man.
Infact I think we should atleast update this document.
Because in document https://github.com/RonRadtke/react-native-blob-util#download-example-fetch-files-that-need-authorization-token as well they mentioned to give path directly and not inside addAndroidDownloads.
@RonRadtke I think this should be updated in document.
Kamani commentedon Jul 14, 2021
@RonRadtke Infact document contains many links which are resolving to 404. That should be also removed. If document will be clear I do think lot's of developer's will find it helpful.
RonRadtke commentedon Jul 14, 2021
The documentation for sure could use a clean up. You're right about that.
The link you posted is not linking to the correct url.
And it is correct that the path is outside in this example.
Have a look at this part: https://github.com/RonRadtke/react-native-blob-util#android-media-scanner-and-download-manager-support
The outer path is only used if you don't use the addAndroidDownloads, if you're using the DonwnloadManager you need to specify the path within the addAndroidDownloads section.
anniewey commentedon Dec 8, 2023
@RonRadtke I'm seeing this issue in
"react-native-blob-util": "0.19.4"Tried different dirs (
DownloadDir,DocumentDir,CacheDir) but getting the same error.My config: