开发者

iPhone/Android SDK , detect when in sleep/standby

开发者 https://www.devze.com 2023-03-27 15:15 出处:网络
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 ?

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
0

精彩评论

暂无评论...
验证码 换一张
取 消