My camera app preview is too dark in low light. If I open my google camera it will increase brightness inside the preview so that our face is visible to take photos. But my preview is completely dark. I have handled the brightness and lightsensor. My Lightsensor works when is some light. I need to make preview is visible. Let me what should I have to handle?
public void initialBrightness() {
try {
brightnessMode = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE);
} catch (Settings.SettingNotFoundException e) {
e.printStackTrace();
}
if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
brightnessModeAuto = true;
}
Settings.System.putInt(this.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 95);
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = 100;
getWindow().setAttributes(lp);
}
I'm calling this method in onCreate method before camera preview class is called.