Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Here we are going to discuss how to download large files and save partial data even when the app is terminated and also updating the view when is in the background.
Creating an object of URLSession
Create an object of URLSession which you have to config the identifier using URLSessionConfiguration after make isDiscretionary true so that we will enable downloading with performance in the background state.
After that pass URL from which you want to download the using downloadTask method of URL session class
then file downloading will start to track the download data likes totalBytesExpectedToWrite, totalBytesWritten from that you can calculate how much data is downloaded with this delegate method
After when your file is downloaded you can save in directory of your app.
Suppose user put your application in background mode then handleEventsForBackgroundURLSession method call of the app delegate class
And downloading is completed in background state then you have to update the view in the main thread
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Name
Email
Subject
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.