CJ Teuben
CJ Teuben

Reputation: 970

Force iPad to stay awake while app is running a process

When my app starts for the first time, if the iPad goes into sleep mode the app doesnt run properly. Is there a way to force the iPad to stay awake during this process?

Upvotes: 1

Views: 3284

Answers (3)

Sam
Sam

Reputation: 27354

You might want to consider using something like the ASI library to make downloading the file easier. http://allseeing-i.com/ASIHTTPRequest/

Is the problem that you are in the middle of a database transaction and the download is a key piece of the transaction? If so you should defer saving the database commands until you are ready to commit OR even better, download the file before making DB changes.

Upvotes: 0

sarunw
sarunw

Reputation: 8176

You shouldn't expected user to do something (wait) to make you app run properly. From you reply on @Eiko you have to downloaded something on the server, in this case could you delayed the download until its really need and prompt user for some text before your download, with this approach user will get some idea of what is he waiting. This is all I can think of with your information.

Upvotes: 0

Eiko
Eiko

Reputation: 25632

While you can disable the sleep mode programmatically, your correct approach here is to fix the bug.

You cannot prevent the user from switching the device off manually anyway.

Upvotes: 2

Related Questions