Download PDF file and share to email or cloud

#1

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

#2

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"
  ]
}
#3

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

#4

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

#5

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

#6

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

#7

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.

#8

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

1 Like
closed #9

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