I have a GDK immersion application, where the launcher Activity
acquires aSCREEN_DIM_WAKE_LOCK WakeLock
. The app also has a Service which will receive chat messages and starts an Intent
for an Activity
to display each one. Whenever the message Activity
is opened, I want to brighten the screen. However, all of the methods I have found do not seem to work.
For example, adding the following into onResume
has no effect:
Settings.System.putInt(getContentResolver(), SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_MANUAL);
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = 1.0f;
getWindow().setAttributes(lp);
To better illustrate the problem, here is the sequence of events in my app:
- Activity A starts and acquires a SCREEN_DIM_WAKE_LOCK. Activity A dims after a short time.
- Service B receives a chat message over the network and creates an Intent for Activity C
- Activity C opens, sets the screen brightness as shown above, but remains dimmed
How can I get the screen to brighten?