打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
AIR for Android and Wake Lock with Keyguard |...

AIR for Android and Wake Lock with Keyguard

I have an application where I want to prevent sleeping, but I still want the user to be able to lock the screen using the power button.  The conventional wisdom is to do something like the following:

protected function view1_addedToStageHandler(event:Event):void{    NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;    stage.addEventListener(Event.DEACTIVATE, releaseWakeLock);}protected function releaseWakeLock(event:Event):void{    NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;}

This, however, does not work.  The problem seems to be that the Android OS receives the sleep event before the AIR application does, and therefore when the user presses the power button again, the screen is not locked.  The solution, fortunately, is simple – just don’t enable the DISABLE_KEYGUARD permission in the android manifest.  The comments from Adobe say to toggle both DISABLE_KEYGUARD and WAKE_LOCK together, but everything seems to work as I would expect with just WAKE_LOCK.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
android-KeyguardManager FLAG_DISMISS_KEYGUARD服务
android wakelock申请与释放
Linux内核机制之等待队列
linux中的阻塞机制及等待队列
android电源管理
Android在标准linux基础上对休眠唤醒的实现
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服