Android App Development
iOS 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 126.96.36.199 release ready!
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*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.