Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

continuing download after the app goes to background

Tags:

iphone

ios4

In my app, i download around 25mb+ data. During the download process if the user press the center button and app goes background what should be done so that the download continues once the app comes to foreground

like image 697
thndrkiss Avatar asked Sep 28 '10 13:09

thndrkiss


2 Answers

Check out the Executing Code in the Background section of the iOS Application Programming Guide, which says:

Any time before it is suspended, an application can call the beginBackgroundTaskWithExpirationHandler: method to ask the system for extra time to complete some long-running task in the background.

like image 124
David Gelhar Avatar answered Nov 10 '22 22:11

David Gelhar


You have a little bit time to store and decide to do something when the app goes into the background. I think the best way is you cut your data off by some way.

If it is text data, it will be easy, just break into many smaller text files and remember what you downloaded.

If it contains lots of images and videos, save the last (may be index) of the image or video you downloaded.

Generally, try to break up your data to many smaller ones so that a break in one will not affect other parts and you can redownload that part.

like image 2
vodkhang Avatar answered Nov 10 '22 20:11

vodkhang