iPhone Preventing iPhone from powering off during an app...

Hello all,
Back with you for yet another question...
Anybody knows how to prevent the iPhone from powering off if no input while an app is running ?
I'm thinking of building an app that would launch an alarm when motion is detected, but the app would need to be run without the iPhone powering off...
Thanks for any ideas, I haven't found anything yet, but I know it's possible as many "official" apps support this...
Thanks.
Serge

Ok, we're talking about the same thing. It's called "system sleep" in the docs, and the user setting under Settings->General is called "Auto-Lock" in English. This is how to turn Auto-Lock off for your application:
[UIApplication sharedApplication].idleTimerDisabled = YES;
Here is the precaution from the UIApplication reference:
Important: You should set this property only if necessary and should be sure to reset it to NO when
the need no longer exists. Most applications should let the system turn off the screen when the idle
timer elapses. This includes audio applications. With appropriate use of Audio Session Services,
playback and recording proceed uninterrupted when the screen turns off. The only applications that
should disable the idle timer are mapping applications, games, or similar programs with sporadic
user interaction.

Similar Messages

  • I tried to restore my iphone 5s but it shut off during the restore and wont turn back on I tried reseting it with the home and power button but it doesnt work and I tried connecting it to itunes but it doesnt show up

    I tried to restore my iphone 5s but it shut off during the restore and wont turn back on I tried reseting it with the home and power button but it doesnt work and I tried connecting it to itunes but it doesnt show up

    Did you try to connect in recovery mode, as explained in this article?
    If you can't update or restore your iOS device
    If this does not work, get it checked by an Authorized Apple Service Provider or by Apple:
    iPhone - Contact Support - Apple Support

  • My iPhone 4S keeps randomly powering off

    Do you know why my iPhone 4S keeps randomly powering off?  I have rebricked my phone and it still does this.

    Are you using a case with your iPhone? It could be holding down the power button on the top of the iPhone.
    You can try restoring the iPhone as a new device, if that doesn't do it send it in for service.

  • My iPhone 3GS randomly turns itself off during texting or call

    My iPhone 3GS randomly turns itself off during texting or call

    Is your battery very run down?  Try charging it for hours (or overnight).

  • TS3694 So I have an iphone4g in recovery mode. followed all the steps to the T. Error pops up in itunes 1602. Prior it was powered off during erase all content and settings mode waiting to reboot

    So I have an iphone4g in recovery mode. Followed all the steps to the T. Error pops up in itunes 1602. Prior it was powered off during erase all content and settings mode while waiting to reboot. Now its back to the apple logo. Any ideas if powering it off during the erase all content damaged the software?

    You should really read the manual.
    "How do you restore from backup? "
    Restore.  When given the choice, choose to use backup.
    "And how can I check to see if the pics and videos are on my computer somewhere first??"
    They would only be where you put them.  What program did you use to import them?  Pics/vids taken with ipod are not part of the sync process at all.  You should be importing them just as you would with any digital camera.
    If you did not import them, then they are not on your computer.

  • Equium A300D suddenly powers off during use

    I just got an Equium A300D about 3wks ago and it suddenly powers off during use.
    What can be caused this?
    Though it doesn't do it frequently but am still very concerned.

    Sounds like its overheating. My previous laptop did a similar thing.
    Is the laptop used in a dusty environment? Perhaps there is dust buildup in the heatsink.
    When you use the laptop, are the vents covered by other objects?
    Otherwise if its not an overheating issue, and you are using the original Toshiba AC Adapter, bring the laptop to an Authorized Service Center for repair.

  • HT201413 ipod powers off during restore

    Cannot get my ipod touch to restore.  It powers off during restoration.  Is this normal? 

    Hi tckm,
    A restart is normal, as in step 4 here:
    iTunes: Restoring iOS software
    http://support.apple.com/kb/ht1414
    However, if the device is powering off and staying off, this article is probably the way to go:
    iOS: Unable to update or restore
    http://support.apple.com/kb/ht1808
    I hope this helps!
    - Ari

  • IPhone 6 powers off during charging

    I charge my 6 while I sleep. Three days ago, my alarm didn't wake me in the morning. Come to find out, my phone was powered off and the only way to wake it was to hold both power buttons like a hard reboot. That first day, the battery was not fully charged when I finally figured out how to wake it. The next night, I woke in the middle of the night and checked it- it was off again. I restarted it and the battery was at 100%. I left it plugged in and in the morning it was off again. The third night, I switched chargers and when I woke in the middle of the night it was off. I restarted it and unplugged it from the wall charger. In the morning it was still on. So this is happening only with the charger plugged in. Is there a setting that I'm missing or is this a defect??

    actually i am updating from itunes. but the 2 logos stays ... and like i've said, it restarting, back to logo, restarting again, back to logo again, and still... the update indicator in itunes shows that i will have to wait another 63 minutes now to complete the downloading. it is moving, slowly

  • HT4061 My iPhone was stolen and powered off.  Is there any way to track it?

    My iPhone 5c was stolen last night.  It was powered off.  I was wondering if anyone knows a way to track its location.

    Only if it's powered on at some point, Find My iPhone will be able to make note of it's last position.
    There's no way to track an electronic device that is powered off, it's just like trying to track a book.

  • MSI GTX 770 LIGHTNING - Unexpectedly Powers Off During 3DMark Demo (Ice Storm)

    I run the 3DMark demo (I believe Ice Storm is the benchmark) on my PC containing this MSI GTX 770 LIGHTNING and at about 15 seconds or so, my PC suddenly powers off. I know that at least somebody else has experienced this issue before, but is this a common/semi-common problem? Is it something to be worried about? If I were to run other things (games, benchmarks, etc.) fine but still have problems with this demo, would that be indicative of an issue with the demo, or an issue with over-stressed hardware that still needs to be RMAed?
    All other benchmarks runs fine, like even UNIGINE HEAVEN or games are now stable.   PSU IS:
    Be Quiet Dark Power Pro 1000W
    I7 3770 3.5
    I even found somebody with similiar problem , look:
    http://www.tomshardware.com/answers/id-1799789/evga-gtx-780-unexpectedly-powers-3dmark-demo-ice-storm.html
    Even youtube:
    Other person comment:
    "SalandFindles":
    I simply can't get past the 1:38 mark without my computer fully turning off by itself during this Ice Storm video benchmark. I quickly checked the temps right after I turned my computer on after this crash and they didn't seem anything out of the ordinary. So, what do you think my problem is?
    AMD FX-6300
    Gigabyte Radeon HD 7970
    12 GB DDR3 1600 RAM
    120 GB SSD
    1 TB HDD
    Biostar Motherboard
    Corsiar 750W Power Supply.
    Its only ICE STORM DEMO again now:(

    Quote from: sew333 on 07-November-13, 23:43:50
    I know 750w is sufficient for a 770 but does it have enough amps on the 12v rail?
    http://www.morele.net/zasilacz-ocz-zt-series-750w-fully-modular-80-plus-bronze-atx12v-v2-2-active-pfc-ocz-zt750w-eu-433644/
    http://www.newegg.com/Product/Product.aspx?Item=N82E16817341052
    Take it?
    Quote from: sew333 on 07-November-13, 23:43:50
    I know 750w is sufficient for a 770 but does it have enough amps on the 12v rail?
    It has the max amps that's possible for this wattage.
    It has more than enough
    Quote
    http://www.morele.net/zasilacz-ocz-zt-series-750w-fully-modular-80-plus-bronze-atx12v-v2-2-active-pfc-ocz-zt750w-eu-433644/
    http://www.newegg.com/Product/Product.aspx?Item=N82E16817341052
    Take it?
    no, those are craps, i've told you what to pick.

  • Macbook Pro continually powers off during start up process.

    My daughter's 13" MacBook Pro (late 2011 - MD313B/A) is not completing it's startup process and continually powers off approximately a 1/5th of the way along the startup "process bar".  Unfortunately, I can't obtain any further info regarding the Operating System etc but am assured that all Apple software is up-to-date.  Both basic and enhanced hardware diagnostic checks show no apparent problems.  Apparently, my daughter was downloading an original music CD to her collection last night when the system froze.  She forced a power shut off and are now unable to power the machine up. Unfortunately we are about 6 weeks outside the extended AppleCare Protection Plan period! Any help and guidance would be greatly appreciated.Thanks.

    First try SMC and NVRAM resets:
    https://support.apple.com/en-us/HT201295
    https://support.apple.com/en-us/HT204063
    If there is no change, boot into the recovery partition.
    From the 4 option menu select Disk Utility.
    Run Disk Utility>First Aid,  Verify and Repair.
    If the disk cannot be repaired, it will have to be replaced.
    Ciao.

  • Wake on Lan from Powered Off

    Hi,
    Is it possible to Wake on Lan from a powered off state?
    I have a new iMac running Snow Leopard 10.6.5, with an ethernet cable attached.
    Thanks.

    No, the iMac will only "wake" from sleep.
    Regards,
    Captfred

  • IMac (Intel) 20" running osx 10.5 shuts down (powers off) during restart process

    My iMac suddenly shut off during the power up process immediately after the apple appeared on the gray screen.  I tried resetting the SMC and PRAM with no success.  I tried booting from the install disk and still no Joy.  Any other ideas?

    Ouch, best bet is a badly muxed Hard Drive, but see if this works...
    One way to test is to Safe Boot from the HD, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, Test for problem in Safe Mode...
    PS. Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive

  • HP Pavilion dv9700z powers off during or immediately after POST

    My aunt brought me her brother's computer that inexplicably stopped working.  She told me if I could fix it I could have it, and she ordered a new HP.
    The computer in question is an HP Pavilion dv9700z entertainment PC.  The problem is that it powers itself off shortly after powering on.  Usually this occurs during power-on self-test (POST), while the HP Invent splash screen is displayed.  On occasion it gets a bit further, like if I press F10 to go into the BIOS to check the logs.
    I thought if I could get into the BIOS logs, perhaps there'd be a clue as to the problem, but the one time I could get to the log, there was nothing unusual; there was one entry that said success but the machine powered off before I could read it.
    I completely disassembled the computer to check for obvious problems (i.e. a disconnected cable, blown/swollen/leaky capacitor, burn marks) but there was nothing visible--except for plenty of nicotine "tar" on the fan blades and on the heatsink.  I asked my aunt if my uncle was a smoker and she said a heavy smoker.  That explains the nicotine I found.
    The question is this:  why would the machine power off within 30-60 seconds of being powered on?  Even if I let the machine sit for hours in a cool location--that seems to rule out overheating--the same problem persists.  Power down occurs within 30-60 seconds every time.
    The fan does run, but sometimes it shuts off before the machine powers down...that seems odd.  My wife has a dv9xxx and the fan NEVER shuts off completely.
    I disconnected several components to rule them out, like the wi-fi card, hard drives, memory, etc. but the problem persists.
    I've come to the conclusion that it's one of these three that's the problem:  fan/heatsink, motherboard or power button board (sticking, perhaps)?  I checked all cable connections and used rubbing alcohol on some contacts to clean off what appeared to be nicotine tar, waiting a full day before powering anything on.  The problem persists...
    Thoughts anyone?  If it's the fan/heatsink or power button board, it'll be totally worth the repair cost and effort which I can do myself.  If it's the mobo, probably not worth it.
    Danke,
    Matt

    I was wrong.  After a day of the computer working seemingly correctly, the same problem returned.
    I am thus at a loss of why this laptop keeps shutting off.  Is there a temperature sensor on the motherboard or airflow sensor that is perhaps obstructed by niccotine?
    I'd like to get it working again if I can do so myself.  But I wonder if it's just a lost cause...

  • IMac powers off during DVD playback, why?

    Right now, since the last update and my Applestore repair, by iMac powers off everytime I watch a DVD. Doesn't matter which player, I've tried Front Row, DVD Player, VLC, and Realplayer. It will play for 30seconds - 5minutes, and then power off. No error message.
    My drive completely failed a few weeks ago, so I brought it to the Apple Store. They held it hostage for over a week and replaced the drive, the drive cable, and the "smart board" or whatever they called it. Upon return the drive works as expected... except this issue.
    I run my business from my Mac so I want to make sure there isn't a simple way to fix this before I go back into the Apple Store (1 hour away).
    Any ideas??
    -Garrett

    Hi, cannot tell you why..call AppleHelp (USA 1-800-275-2273)....L

Maybe you are looking for