I'm using this method to set the screen to full brightness.
@SuppressLint("NewApi")
private void setFullBright() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
WindowManager.LayoutParams windowParams = getWindow().getAttributes();
windowParams.screenBrightness = 1.0f;
getWindow().setAttributes(windowParams);
}
}
If I want the full brightness to be set on the entire life of the Activity's screen, is the onCreate method the best place to call it?
Is there an XML flag that can achieve this? Something like android:keepScreenOn="true" that mirrors the functionality of adding WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON in code?