How can I wake an android device up and skip the screenlock

一曲冷凌霜 提交于 2019-12-07 06:22:39

问题


As title, is it possible for me to wake my phone up and skip the screenlock? I want to write an app based on the alarm clock, when it's time, the app should do detect something in the background even when the phone is sleeping. When something is detected, the phone should automatically wake up, skip the screenlock, and show a picture(start a new activity ). Can anybody give me some suggestions or examples on these? Thanks a lot!


回答1:


The activity you're starting needs one or both of the following layout parameters.

Use FLAG_SHOW_WHEN_LOCKED so that the activity appears above the screenlock.

Use FLAG_DISMISS_KEYGUARD to automatically dismiss the keyguard.

More details at http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html.



来源:https://stackoverflow.com/questions/6315433/how-can-i-wake-an-android-device-up-and-skip-the-screenlock

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!