Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(iOS only) Resumable downloads and better background downloads handling #335

Merged
merged 6 commits into from
Dec 10, 2017

Conversation

ptelad
Copy link
Contributor

@ptelad ptelad commented Aug 22, 2017

Hi,

We've discussed about resumable downloads in my last pull request, I have not made any changes to this feature in this one.

Now about background downloads:
In my app I'm downloading large files, so bg-d/l is crucial.
I've encountered issues with bg-d/l using RNFS and found out it's because the download tasks's completion handler is not being call, thus iOS brutally terminates the app.
So I've added a new method called completeHandlerIOS(jobId) that will call that job's completion handler.
Now bg-d/l are safe to use and you can easily do some stuff after the download is done and then call completeHandlerIOS().
readme was updated with a tutorial on how to set this up in the AppDelegate.m file.

I've also removed the bit in the readme about needing to activate 'background fetch' since it's not true, background fetch is for periodically connecting to the internet to fetch some data, it's not needed for downloads.

@DanNi0130
Copy link

@itinance Can we please merge this?

@parim
Copy link

parim commented Dec 9, 2017

@itinance I also need to confirm the completed event in background.
Now it doesn't work properly.
Can it be fix?

@itinance
Copy link
Owner

itinance commented Dec 9, 2017

I'll look at this on this weekend and will test it and merge if all works fine!

@itinance itinance merged commit a991f17 into itinance:master Dec 10, 2017
@itinance
Copy link
Owner

Tested, merged and published. Thank you all!

@parim
Copy link

parim commented Dec 11, 2017

Great! it works well now.
thanks! @itinance @ptelad

I have one more question.
Is it possible to trigger download function - RNFS.downloadFile(...) in background mode?
(i.e. by receiving push notification)
Already I tried, but it doesn't start downloading until app is opened.

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

Successfully merging this pull request may close these issues.

4 participants