This repository was archived by the owner on Mar 16, 2019. It is now read-only.
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
Notification doesn't download file #442
Closed
Description
Tying to use the option addAndroidDownloads and create a notification but the notification never opens the file.
I can use
let sendIntent = RNFetchBlob.android.actionViewIntent;
sendIntent(path, mimeType);
To open the downloaded file for android and it works accordingly, added it to the notification click (implemented by third party) and everything goes smoothly except that even disabling addAndroidDownloads notification it always stays there... and whenever clicked, it says "can't open file" in a toast and nothing happens.
Here's the complete function i'm currently using to download
_downloadFile(fileName,url) {
const PictureDir = RNFetchBlob.fs.dirs.PictureDir;
var tipoFIcheiro = mimetype.lookup(fileName);
if (!tipoFIcheiro)
tipoFIcheiro = "image/png"
RNFetchBlob
.config({
fileCache : true,
addAndroidDownloads : {
title : fileName,
mime : tipoFIcheiro,
useDownloadManager : true,
description : fileName,
mediaScannable : false,
notification : false,
}
})
.fetch('GET', url, {
//some headers ..
})
.then((res) => {
// the temp file path
let base64Str = res.data;
let imageLocation = PictureDir + '/' + fileName;
//Save image
fs.writeFile(imageLocation, base64Str, 'base64');
if (Platform.OS === 'ios') {
notify("Download Completo",fileName)
} else {
notifyFicheiro("Download Completo",fileName,tipoFIcheiro,res.path())
}
})
}
Thanks in advance