3

I created application to download files. For downloading i use ASIHTTPRequest. When I start download big file, and lock my device, after some time my download stops, wi-fi disables and i see Edge icon instead of Wi-fi icon. When I unlock my device, Wi-fi icon appears in 1-2 seconds. My application is not in background! How to solve my problem?

Timur Mustafaev
  • 4,869
  • 9
  • 63
  • 109

3 Answers3

4

Two things come to mind:

Firstly enable persisten wifi connection for you app: My iPhone app needs a persistent network connection...how to specify UIRequiredDeviceCapabilities?

Secondly make the app request background time when it goes into the background so the actual download can continue: Continuing a long running process in the background under iOS4

Community
  • 1
  • 1
huesforalice
  • 2,418
  • 2
  • 24
  • 29
2

I'm not sure if 10 minutes after locking the device if the app would count as running in the background or not.

I'd at least try enabling background downloading in ASIHTTPRequest:

[request setShouldContinueWhenAppEntersBackground:YES];

It might help and you've nothing to lose :)

JosephH
  • 37,173
  • 19
  • 130
  • 154
  • I've done this already :) In background it works good BUT only when i use phone while downloading. When I lock device wi-fi turns off after 5-10 mins. On the iPad 2 wi-fi works all the time. Even when device is locked. So I think this "feature" cannot be disabled on iPhone, because it saves battery life. – Timur Mustafaev Oct 19 '11 at 08:46
0

You can also prevent the IPhone to lock the screen. It'll use more battery but will solve your problem:

UIApplication *myApp = [UIApplication sharedApplication];
   myApp.idleTimerDisabled = YES;
ppaulojr
  • 3,579
  • 4
  • 29
  • 56
  • IMHO huesforalice's answer is a better one, but disabling the idle timer can be useful in some circumstances. Remember to re-enable the idle timer or the user may come back to a completely dead device! See also http://stackoverflow.com/questions/1023265/delaying-but-not-disabling-iphone-auto-lock – JosephH Oct 16 '11 at 13:32