Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Android Download Manager - download happens succesfully but promise rejects #606

Open
Noitidart opened this issue Nov 23, 2017 · 2 comments

Comments

@Noitidart
Copy link

The download happens succesfully, even the notification is shown, using code:

        const res = await RNFetchBlob.config({
            addAndroidDownloads: {
                useDownloadManager: true,
                mime: mimeType,
                description: description || 'File from network',
                mediaScannable : true
            }
        }).fetch('GET', originalUrl, { 'Cookie':cookie });

However promise rejects for some file types (pdf) with: "Error: Download manager could not resolve downloaded file path."

Possible Unhandled Promise Rejection (id: 1):
Error: Download manager could not resolve downloaded file path.
fetch/promise</<@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:97845:23
__invokeCallback@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:2021:7
invokeCallbackAndReturnFlushedQueue/<@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:1845:9
__guard@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:1956:9
invokeCallbackAndReturnFlushedQueue@http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:1844:7
onmessage@http://localhost:8081/debuggerWorker.js:72:25
EventHandlerNonNull*@http://localhost:8081/debuggerWorker.js:15:14

@jslok
Copy link

jslok commented Nov 28, 2017

I had the same issue. Add a path to the config.

    const res = await RNFetchBlob.config({
        addAndroidDownloads: {
            useDownloadManager: true,
            mime: mimeType,
            description: description || 'File from network',
            mediaScannable : true,
            path: RNFetchBlob.fs.dirs.DownloadDir + "/" + someFilename
        }
    }).fetch('GET', originalUrl, { 'Cookie':cookie });

@Noitidart
Copy link
Author

Interesting @jslok thanks for sharing!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants