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...)
viewWillAppear unfortunately does not get called since my application technically was still running the whole time...
j z
2009-06-18 03:27:01
A:
- (void)applicationDidBecomeActive:(UIApplication *)application;
This sent when your app becomes active
Another answer on SO applicable to your question:
Corey Floyd
2009-06-17 19:20:35
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
2009-06-18 03:27:39
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
2009-06-18 05:29:50