android - How can I brighten the screen when opening an Activity in my Glass GDK immersion application? -


i have gdk immersion application, launcher activity acquires ascreen_dim_wake_lock wakelock. app has service receive chat messages , starts intent activity display each one. whenever message activity opened, want brighten screen. however, of methods have found not seem work.

for example, adding following 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 problem, here sequence of events in app:

  1. activity starts , acquires screen_dim_wake_lock. activity dims after short time.
  2. service b receives chat message on network , creates intent activity c
  3. activity c opens, sets screen brightness shown above, remains dimmed

how can screen brighten?

i able find solution acquiring screen_bright_wake_lock acquire_causes_wakeup flag in onresume. example:

powermanager pm = (powermanager) getsystemservice(context.power_service); powermanager.wakelock wl = pm.newwakelock(powermanager.screen_bright_wake_lock | powermanager.acquire_causes_wakeup, "my tag"); wl.acquire(); //..screen stay on during section.. wl.release(); 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -