Skip to content Skip to sidebar Skip to footer

Change Screen Brightness OnPause (Android App)

My app saves the user original brightness with: originalBrightness = Settings.System.SCREEN_BRIGHTNESS; and then changes it while the program running. originalBrightness is private

Solution 1:

Try Using Settings.System.SCREEN_BRIGHTNESS to set system default brightness as:

android.provider.Settings.System.putInt(getContentResolver(),  
android.provider.Settings.System.SCREEN_BRIGHTNESS,brightness /100.0f); // 0-255 

and add these permission's in manifest :

<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />

Post a Comment for "Change Screen Brightness OnPause (Android App)"