FileSystem - unable to pause download

  1. SDK Version: 40.0.0
  2. Platform: Android (testing on Pixel 3a)
  3. FileSystem

I’ve seen this issue on other posts, but I haven’t seen a resolution to it. Basically, I’m trying to create a download button for an audio app - I’d like to be able to launch a download, then pause and resume it as it goes. However, when I use ‘pauseAsync’ I get the “No download object available”.

Here is a Snack of the code I’ve been creating: FileSystem Test - Snack

Thanks,
Zach

Hey @zachbattalion, you’re seeing that error because a new downloadResumable object is being created every time that your DownloadButton component re-renders (which is happening often due to the progress state variable).

Cheers,
Adam

Amazing - thanks Adam… seems obvious now you mention it!

I’ve saved the initial downloadResumable in a useRef hook and now it works :slight_smile: Thank you

I’ll update the Snack for anyone else who is stuck on the same issue :+1:

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