I'm trying to use the library rn-fetch-blob to download a file from a response from my api. I want to use the android download manager so the user can access the file outside of the app.
if (granted === PermissionsAndroid.RESULTS.GRANTED) { let DownloadDir = fs.dirs.DownloadDir //android only directory let options = { fileCache: true, addAndroidDownloads: { useDownloadManager: true, notification: true, path: DownloadDir +"/"+ name, description: 'Downloading image.' } } try { config(options).fetch('POST', `${apiBaseUrl}/document/download/requirement`, { Authorization: "Bearer "+ this.props.userDetails.token,'Content-Type': "application/json" }, data ).then((res) => { console.log("TEST") console.log(res); }).catch((error) => { console.error('Error:', error); }); } catch (err) { console.log(err) }}
When this runs, the response block is being skipped and the line console.error('Error:', error); is returning the following error: 'Error:', { [Error: Download manager failed to download from https://myurl.com/api/document/download. Status Code = 16]
When I comment out the line useDownloadManager, I get a successful response from the api, so I know that's working. I believe a status code 16 refers to a problem with the android file path, but after hours of research I'm unable to determine what could be wrong in regard to that.