iPhone/Android SDK , detect when in sleep/standby
How can I tell when my app is open and the user use the power button to shut the display, or the iPhone shuts the display on its own ?
what I need to do, is wait for an event, then figure out if the screen 开发者_如何学编程is off and wake the screen with an alert.
actually, I need this to work on both the iPhone and Android versions of my app
I'll appreciate any insight for both platforms
thanks
For iphone I think you are talking about lock state. If yes then you can use this methods
- (void)applicationWillResignActive:(UIApplication *)application
- (void)applicationDidBecomeActive:(UIApplication *)application
精彩评论