I have been trying to fix an issue with downloading a zip
file from our service on our Android
app. The iOS
works fine, but on Android
I get the following error:
ExceptionsManager.js:149 Error downloading file Error: Download manager failed to download from <download_urll> Status Code = 16
My download code looks like this. We are using react-native-blob-util
:
const FILE_URL = uri;
const { config, fs } = ReactNativeBlobUtil;
const { dirs } = fs;
let writePath = dirs.DocumentDir;
if (Platform.OS === 'android') {
writePath = `${dirs.DownloadDir.split('Android')[0]}Download`;
}
const options = {
fileCache: true,
addAndroidDownloads: {
path: writePath + '/' + fileName + '.' + fileExtension,
description: `Downloading ${fileName}{}`,
notification: true,
useDownloadManager: true,
},
};
return await config(options)
.fetch('GET', FILE_URL, {
'Authorization': `Bearer ${authToken}`,
'Content-Type': 'application/zip',
})
.then(() => {
// Handle download success
})
.catch((e) => {
// Handle download failure
});
I have tried pretty much everything I found on the answers here, here, here and even here. And also several other places I found. I have checked the authentication too. It's not that.
Any idea what this might be? The issue is that this seems to occur only in the production variant of our Android
app, and works just fine on the rest, including the production variant of our iOS
app. A real head scratcher.
Any ideas are welcome.