tags:

views:

217

answers:

2

I have an iphone game that plays background music using AVSoundPlayer - when someone locks the iphone the music stops which is fine. But when someone unlocks it, I don't want my music to start playing again while you're staring at the "slide to unlock" screen - I want it to start playing once you've actually slid the button and the app is visible again - is there some way to detect this? (I've tried applicationDidBecomeActive but that fires when the phone is unlocked but not when your app is visible yet...)

A: 

You could try viewWillAppear.

Dan Lorenc
viewWillAppear unfortunately does not get called since my application technically was still running the whole time...
j z
A: 
- (void)applicationDidBecomeActive:(UIApplication *)application;

This sent when your app becomes active

Another answer on SO applicable to your question:

http://stackoverflow.com/questions/704789/applicationwillterminate-works-as-long-as-i-dont-switch-off-the-iphone/716912#716912

Corey Floyd
again, applicationDidBecomeActive is called when the user presses the lock/unlock button, but I want to know when the user actually gets rid of the "slide to unlock" screen itself..
j z
I don't think your application becoming active on the touch of the unlock button, even if you don't slide to unlock, is expected behavior. If that is indeed what you are experiencing, I would file a bug. Obviously, if the phone is still locked your app shouldn't be notified that it has become active.
Corey Floyd