UiModeManager - NightMode (FroYo)
Posted
by Kaloer
on Stack Overflow
See other posts from Stack Overflow
or by Kaloer
Published on 2010-05-23T14:45:50Z
Indexed on
2010/05/23
14:51 UTC
Read the original article
Hit count: 612
Hi there,
I have been trying to turn off the buttons' light in my application using the UiModeManager's nightmode function. The default Desk Clock application (Nexus One) turns off the buttons' light when it is dimmed, and I want to do this as well.
I've tried using the following code:
UiModeManager mgr = (UiModeManager) getSystemService(UI_MODE_SERVICE); mgr.setNightMode(UiModeManager.MODE_NIGHT_YES);
The UiModeManager.setNightMode(int mode) documentation says this:
Sets the night mode. Changes to the night mode are only effective when the car or desk mode is enabled on a device.
Does that mean that the device has to be physically in a desk dock? I can set the device to car mode using the UiModeManager.enableCarMode(int flags) method. This works fine, but it doesn't turn off the lights, it only dims the screen's backlight.
Is there a way to set the device into desk mode without using a physical desk dock? As the FroYo source code is not yet released, I cannot look at the build-in Desk Clock application.
Thanks in advantage.
© Stack Overflow or respective owner