How to adjust screen bright immediately in service not activity?

I use Android SDK 1.5

i tried

 WindowManager.LayoutParams lp = getWindow().getAttributes();
  lp.screenBrightness = 1.0f;
  getWindow().setAttributes(lp);

but it can't work in service because service has no getWindow()

and I tried

 brightness = Settings.System.getInt(getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS)

 it's no use in service

so how to adjust screen bright "immediately" in service?

And when I call goToSleep() in PowerManager, it shows
SecurityException but i already add permission DEVICE_POWER to
manifast but it's still wrong why?
thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to