Usage and explanation of FLAG_SHOW_WHEN_LOCKED in android

Source: Internet
Author: User

How to Make an activity floating above the screen lock interface, return to enter the unlock interface.
For example, on the screen lock page, you do not need to unlock a call before you can answer the call. This can bring speed.
If you want to implement iphone 4S above the screen lock interface on android, you can also do it in this way.
You only need to add the following flag to the onResume function of the Camera activity.


Import android. view. Window;
Import android. view. WindowManager;


Final Window win = activity. getWindow ();
Final WindowManager. LayoutParams params = win. getAttributes ();
Params. flags | = WindowManager. LayoutParams. FLAG_SHOW_WHEN_LOCKED;


/** Window flag: special flag to let windows be shown when the screen
* Is locked. This will let application windows take precedence over
* Key guard or any other lock screens. Can be used
* {@ Link # FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
* Directly before showing the key guard window. Can be used
* {@ Link # FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
* Non-secure keyguards. This flag only applies to the top-most
* Full-screen window.
*/
Public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.