1

I have a custom Android Service (with no associated Activity) that needs to implement a custom idle timeout value for turning the display off under certain conditions (not all the time). The user can set this in Settings -> Screen -> Timeout. I actually may want to leave that value alone and simply override this setting - that is, in my situation, I don't want the user to be able to alter the value, but when the scenario is complete, I would like to go back to using the Settings value.

Is this possible? I'm searching, but not finding an API. Note that this would be for ICS.

cbp2
  • 245
  • 1
  • 3
  • 12
  • I believe this is what you're looking for. http://stackoverflow.com/questions/3723634/how-can-i-prevent-an-android-phone-from-going-to-sleep-programmatically – DeeV Jan 06 '12 at 15:51
  • 3
    this may be Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, timeInMillis); – njzk2 Jan 06 '12 at 15:56

1 Answers1

0

You should use WakeLocks. See the example in the PowerManager doc

xevincent
  • 3,674
  • 18
  • 20