It should be an easily searchable question yet I can't find a single result. I can find how to retrieve screen brightness but not how to retrieve the status of auto brightness.
And a second question, Android Studio forces me to surround this statement with a try/catch block, which I guess means it won't work all the time. Is there a more reliable way to retrieve screen brightness?
int currentBrightness = Settings.System.getInt(getContext().getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
When I hover the mouse over getInt I get this message: Unhandled exception: android.provider.Settings.SettingNotFoundException
I have to turn it into this:
try {
int currentBrightness = Settings.System.getInt(getContext().getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
} catch (Settings.SettingNotFoundException e) {
e.printStackTrace();
}