Hi,
Is there anyway to put the iPhone into sleep mode from an app? If yes, how can I do that?
Thanks,
Tee
Hi,
Is there anyway to put the iPhone into sleep mode from an app? If yes, how can I do that?
Thanks,
Tee
Not in a public API. There may be something private but you wouldn't be able to use it in the app store. The only method I know of that deals with the sleep mode is being able to disable the sleep while your application is running:
[UIApplication sharedApplication].idleTimerDisabled = YES;
I think the idea is that software shouldn't be able to effect the hardware too much i.e. starting, sleeping quitting your application are not up to you and exit()ing your app manually through code would be a non-standard practice and frowned upon by Apple. The nice thing is that your phone will sleep by default after a short amount of time.
The above is correct. The only way to put an iPhone to 'sleep' is to either wait for the idleTimer, or push the Sleep button on the device. Any other way certainly frowned by Apple. I believe this possibly even falls under the 'private API' which means they can reject it from the Store/approval.