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

Download manager could not resolve downloaded file path #599

Open
keviin55 opened this issue Nov 16, 2017 · 6 comments
Open

Download manager could not resolve downloaded file path #599

keviin55 opened this issue Nov 16, 2017 · 6 comments

Comments

@keviin55
Copy link

keviin55 commented Nov 16, 2017

I am trying to download an apk file and open it with intent. I am using the code found in this issue

upgradeApp(url)
  {
    RNFetchBlob.config({
      addAndroidDownloads : {
        useDownloadManager : true,
        mime : 'application/vnd.android.package-archive',
        mediaScannable : true,
        notification : true,
      }
    })
    .fetch('GET', url)
    .then((res) => {
      alert(res.path());
      console.log('save to ' + res.path())
      let sendIntent = RNFetchBlob.android.actionViewIntent
      return sendIntent(res.path(), 'application/vnd.android.package-archive')
    })
    .then(() => {
      done()
    })
  }

The download manager downloaded successfully the file but I got an error

Download manager could not resolve downloaded file path

I am using react-native: 0.48.4 and a Nexus 5 simulator with Android 7.1.1

@lbhsot
Copy link

lbhsot commented Nov 17, 2017

@keviin55
Copy link
Author

Thank you it worked

@lixiaozhangme
Copy link

@keviin55 ,hello, How do you configure it;This is my configuration, but something went wrong:
RNFetchBlob
.config({
addAndroidDownloads : {
useDownloadManager : true,
notification : true,
title: '二十二城供应商',
mime : 'application/vnd.android.package-archive',
description : '下载中...',
mediaScannable : true,
path: '/storage/emulated/0/DCIM/'
}
})
.fetch('GET', this.state.upFor.supplierApkDownloadUrl)
.then((resp) => {
//res.path();
RNFetchBlob.android.actionViewIntent(res.path(), 'application/vnd.android.package-archive')
}).catch((err) => {
})

@keviin55
Copy link
Author

keviin55 commented Dec 7, 2017

this is my code

RNFetchBlob.config({
      addAndroidDownloads : {
        useDownloadManager : true,
        mime : 'application/vnd.android.package-archive',
        mediaScannable : true,
        notification : true,
        overwrite : true,
        path: RNFetchBlob.fs.dirs.DownloadDir+"/data"
      }

@lixiaozhangme
Copy link

I set the same with you, but the following error:
image
image

@lixiaozhangme
Copy link

@keviin55

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

3 participants