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.
You should use WakeLocks. See the example in the PowerManager doc