本文介绍了醒来的Andr​​oid设备达的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我需要唤醒我那熟睡的Andr​​oid设备了在一定的时间。有什么建议?

Hey i need to wake my sleeping android device up at a certain time.Any suggestions?

P.S。唤醒:打开显示屏上,也许解锁手机

P.S. Wake up: turn display on and maybe unlock phone

推荐答案

最好是使用这些窗口国旗一些适当的组合:

Best is to use some appropriate combination of these window flags:

http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_DISMISS_KEYGUARD
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SHOW_WHEN_LOCKED
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_KEEP_SCREEN_ON
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_TURN_SCREEN_ON

http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_DISMISS_KEYGUARD
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SHOW_WHEN_LOCKED
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_KEEP_SCREEN_ON
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_TURN_SCREEN_ON

如果你想在旧版本不支持所需的旗(县),你可以直接使用唤醒锁和键盘保护锁的平台上运行......但是这条道路是充满了危险。

If you want to run on older versions of the platform that don't support the desired flag(s), you can directly use wake locks and keyguard locks... but that path is fraught with peril.

重要提示:您为了使上述标志相结合的工作活动的必须是全屏。在我的应用程序我试图使用这些标志与活动是不是全屏幕(对话的主题),并没有奏效。看后的文档,我发现,这些标志都需要窗口是一个全屏幕的窗口。

ONE IMPORTANT NOTE: Your activity must be full screen in order for the above flag combination to work. In my app I tried to use these flags with an activity which is not full screen (Dialog Theme) and it didn't work. After looking at the documentation I found that these flags require the window to be a full screen window.

这篇关于醒来的Andr​​oid设备达的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 23:26