Download PDF file and share to email or cloud

Hi,
i’ve to download pdf file from web, save it to device and then share, i’ve tried FileSystem.downloadAsync to download file and then call share function…

FileSystem.downloadAsync(
MY_URL,
FileSystem.documentDirectory + ‘file.pdf’
)
.then(({ uri, status }) => {
Share.share({
url: uri,
});
})

On iOS it work fine but on Android the file is empty (0 bytes)… is a permission problem?
FileSystem get 200 as response code but the file is not saved…

How can i do?
Thanks

I’ve tried to add permissions to app.js but the app don’t ask me it… is it the right syntax?

},
"android": {
  "package": "com.app.test",
  "permissions" : [
    "CAMERA",
    "ACCESS_FINE_LOCATION",
    "READ_EXTERNAL_STORAGE",
    "MANAGE_DOCUMENTS",
    "WRITE_EXTERNAL_STORAGE"
  ]
}

Hi,
no one has ever used the FileSystem.downloadAsync method?

I’ve tryed pubblish apk to Play Store but the behaviour is the same, no ask permission and file downloaded with FileSystem.downloadAsync empty…

Hi! Do you think you could post a Snack that reproduces this issue?

This is the sample: https://snack.expo.io/rk1Ntv78f
I expect to see the file in the download folder of my android

The Expo.FileSystem.downloadAsync downloads a file that the developer can access. It does not download a file to the user-facing Download folder on the device. This is similar to the way iOS behaves as well.

Hi, thanks for reply, is possible after download the pdf file, move it to download android folder or share (cloud, email etc…)?
I’ve to “copy” the file into location accessible outside my app.
Thanks in advance

3 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.