How Android controls screen light and close in activity

Source: Internet
Author: User

The power is controlled by various lock locks in Android, and it is important to note that the lock and unlock must be paired.


It is important to note that the Mainfest permission is required to obtain
The operation to be powered requires that the app has permission to set power management in Androidmanifest.xml.
<uses-permissionandroid:name= "Android.permission.WAKE_LOCK"/><uses-permissionandroid:name= " Android.permission.DEVICE_POWER "/>


In addition, different levels of power management are implemented according to flags ' different values.
about int flags The effects of various types of locks on the CPU, screen, keyboard:
Partial_wake_lock: Keep the CPU running, and the screen and keyboard lights may be off.
Screen_dim_wake_lock: Keep the CPU running, allow the screen to be displayed but may be gray, allow to turn off the keyboard light
Screen_bright_wake_lock: Keeps the CPU running, allowing the screen to be highlighted, allowing the keyboard light to be turned off

Full_wake_lock: Keep the CPU running, keep the screen highlighted, and the keyboard lights remain bright.


Reprint Please specify source: Zhou Mushi's csdn blog Http://blog.csdn.net/zhoumushui

My github: Zhou Mushi's GitHub Https://github.com/zhoumushui


How Android controls screen light and close in activity

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.