I've managed to change screen brightness within an activity (and by extension the entire app) using the following code:
Settings.System.putFloat(this.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS, ((float)LocationService.settings.screenBrightness));
WindowManager.LayoutParams lp = getWindow().getAttributes();
float brightness = someValue;
lp.screenBrightness = brightness;
getWindow().setAttributes(lp);
However, as soon as I close the app the brightness returns to its previous settings. Is there anyway to make these changes persist outside of the lifecycle of the app?
Thanks!