Android: How can I programmatically lock the brightness slider?

geoxile

Some apps that have barcodes or QR codes lock brightness at full and block user changes to the brightness slider from the settings in the pulled down notification bar. One example is Starbucks on their card fragment. How can I achieve the same effect? It even works on android 10

pelya

Something like this:

WindowManager.LayoutParams params = getWindow().getAttributes();
// range from 0 to 1, specify -1 for default brightness
params.screenBrightness = 0.7f;
getWindow().setAttributes(params);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I lock an icon in Android (programmatically)?

how can I detect change in brightness in android?

How can I unlock screen programmatically when the notification action is clicked from lock screen in Android?

How can i check lock screen notifcation is enabled or not programmatically

How can I add focus programmatically in Android?

How can I programmatically include layout in Android?

How can I programmatically cause a delay in Android?

How Can I Do Android Numpad Programmatically

How can I control the brightness of an Image?

How can I change the brightness of an image in pygame?

How can I adjust the brightness of my webcam?

How can I lock files in android using java code?

Android 4.3 : How can I check if user has lock enabled?

How can i display programmatically a textview next to a button in a RelativeLayout in Android?

How can I programmatically decompile dex files within Android?

How can I determine the latest Android version programmatically?

How can I convert an XML to make a programmatically view in Android Java

How can I discover CPU usage of my application in Android (programmatically)?

How can I turn ON/OFF "Show notification" programmatically in android

How can I enable or disable the GPS programmatically on Android?

How can I close/hide the Android soft keyboard programmatically?

How can I programmatically force stop an Android app with Java?

How can I configure Launcher activity programmatically in android?

How can i get current playing song in Android programmatically

How can I know programmatically if a notification channel is enabled on Android O?

How can I get android View kind programmatically?

How can I detect programmatically if the Android Device is in Dark Mode?

Android Kotlin - How can I programmatically disconnect a bluetooth device?

How can I find android apk installation activity programmatically?