How to Disable Keyguard and display an activity to the user when receiver of SCREEN_ON is triggered?

后端 未结 3 919
滥情空心
滥情空心 2020-12-29 00:33

How can I disable the keyguard when a broadcast receiver is activated by screen_on, so that when it occurs the user sees an activity that I have started behind it? (The act

3条回答
  •  失恋的感觉
    2020-12-29 01:05

    i would recommend using the window flags dismiss_keyguard or show_when_locked if you have a window that needs to come over the top of the lockscreen right at wakeup.

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

    how you use this is as follows (called in onCreate before setting layout)

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
    

提交回复
热议问题