-
Notifications
You must be signed in to change notification settings - Fork 786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
download manager could not resolve downloaded file path #214
Comments
after update code ,an error occurred. Possible Unhandled Promise Rejection(id:0): const android = RNFetchBlob.android; |
same issue |
same here |
The same issue =( |
I use both of RNFS and RNFetchBlob. I solved this problem with this solution ` let downloadDest = RNFetchBlob.config({ It works to me. good luck. |
Worked for me! Thanks |
This is due to a bug in It throws this error if if (options.addAndroidDownloads.hasKey("path")) {
...
}
else {
if(filePath == null)
this.callback.invoke("Download manager could not resolve downloaded file path.", RNFetchBlobConst.RNFB_RESPONSE_PATH, null);
else
...
} However, it does not bother trying to retrieve if ( contentUri != null &&
options.addAndroidDownloads.hasKey("mime") &&
options.addAndroidDownloads.getString("mime").contains("image")) {
Uri uri = Uri.parse(contentUri);
Cursor cursor = appCtx.getContentResolver().query(uri, new String[]{android.provider.MediaStore.Images.ImageColumns.DATA}, null, null, null);
// use default destination of DownloadManager
if (cursor != null) {
cursor.moveToFirst();
filePath = cursor.getString(0);
cursor.close();
}
} I don't have time to submit a PR right now, but I believe this would be trivial to fix by changing the logic to: if ( contentUri != null ) {
Uri uri = Uri.parse(contentUri);
Cursor cursor = appCtx.getContentResolver().query(uri, new String[]{android.provider.MediaStore.Files.FileColumns.DATA}, null, null, null); The (also this was previously reported in the original project: wkh237#606) |
I fixed this issue by including the path inside the addAndroidDownloads object. RNFetchBlob.config({ After that the res.path() returns the right location and I can open the pdf file which I have downloaded. |
There is no need to add path and file cache in config field, Download manager ignore both the fields. Having path defined in addAndroidDownloads is enough to work. |
this one worked for me. Thank you very much |
Nice, safe my time, thank you |
This solution works thanks |
When I downloaded apk by download manager, the error occurred.
My code:
const android = RNFetchBlob.android;
RNFetchBlob.config({
addAndroidDownloads: {
useDownloadManager: true,
title: "xxx.apk",
description: "downloading",
mime: "application/vnd.android.package-archive",
mediaScannable: true,
notification: true
}
})
.fetch("GET", appUrl)
.then(res => {
android.actionViewIntent(
res.path(),
"application/vnd.android.package-archive"
);
});
Environment:
OS: Windows 7
Node: 8.12.0
Yarn: 1.9.4
npm: 6.4.1
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found
"rn-fetch-blob": "^0.10.12"
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: ^0.55.4 => 0.55.4
The text was updated successfully, but these errors were encountered: