views:

323

answers:

1
+1  Q: 

Lock-screen iPhone

Hi,

My question is quite simple (I think and hope). I would like to know what happens when I lock my phone. I made a little clock-like app which should play and loop a sound at a given moment (lets say 18:00). But when I press the power button, and the phone locks, nothing happens at 18:00. When I press the power button again 18:05 and the "lock screen" shows, then the sound is played.

Please note, I didn't return to the home screen before locking the phone. The app is still open, when I unlock the app is shown. Is there some way to let the app still do its thing eventhough I locked the screen? Or is this just a programming error I might have made?

Regards, Paul Peelen

+4  A: 

Hi Paul,

You should take a look at information about the application delegate’s applicationWillResignActive: and applicationDidBecomeActive: methods. You can find this information in the iPhone Application Programming Guide. Also, take a look at information about "The Automatic Sleep Timer" in the same guide.

http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#//apple_ref/doc/uid/TP40007072-CH7-SW59

I think you can answer most of your own questions with this information but please post any follow up questions that you might have.

Bart

Bart Gottschalk
great, didn't think of that. I will take a look at it tonight. Thanks in advance!Regards, Paul
Paul Peelen
Hi Paul,Just checking to see if this worked out for you? Bart
Bart Gottschalk
It seemed for a while that this issue was solved, but the alarm still rings 10 - 15 minutes to late. I fixed it using a function how to disallow the phone to go to sleep mode.
Paul Peelen
Glad to hear that you found a solution!
Bart Gottschalk