简体   繁体   中英

Android Changing Screen Brightness. Is a special permission required for this?

I need to change the Screen brightness on a single page to make QR Code reading easier.

I want to do this in the least invasive way possible for the user. I don't really want to send them to the system settings just to make one activity brighter. On the other hand I dont want to request additional permissions if there is a way around this?

Can I prompt the user to provide the permission dynamically on an as needed basis? If not is there another permission that includes the android.provider.Settings.System.SCREEN_BRIGHTNESS permission?

I am trying to reduce the total number of permissions required for the user.

If it's just for your application, I'm pretty sure you don't need to request a permission for it. To change the overall System brightness you do.

Here's a useful link I found:

http://android-er.blogspot.com/2011/02/change-android-screen-brightness.html

From the link:

WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
layoutParams.screenBrightness = BackLightValue;
getWindow().setAttributes(layoutParams);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM