Reputation: 45101
Is there any way to detect if the iPhone wakes up from sleep while you're app is running? Eg: your app is running, the user locks the screen (or the screen auto locks) and some time later the user unlocks the screen and up pops your app. Is there some way to get an event at that point or detect it somehow?
I've tried searching the Google and this forum, but I can't seem to find anything about it.
Upvotes: 7
Views: 4254
Reputation: 1476
Stick these in you AppDelegate.m file:
-(void) applicationWillResignActive:(UIApplication *)application {
NSLog(@"Asleep");
}
-(void) applicationDidBecomeActive:(UIApplication *)application {
NSLog(@"Awake");
}
@Kevin - Nothing wrong with your answer - thanks by the way. Just thought I'd save the next person a Google search.
Upvotes: 9