2

I know there are multiple questions that are similar.


The requirement is to switch screen timeout between "never" and the original setting. When I do Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, -1);, screen doesn't dim on emulator (4.0 Ice Cream Sandwich) and Samsung Galaxy SII (4.1.2 Jelly Bean) but when someone installed on 4.4 KitKat, screen dimmed immediately.

Did something change in OS? Is there a way to set it never to time out on KitKat?

Since I was having trouble setting it never to time out, I was going to set it to 120minutes instead. When I try to set it to a specific time (eg. 60minutes, 120minutes, etc) it is set to 30minutes. Other values seem to get rounded up/down as well. Is it not possible to set it to something that's not the figure listed in Android Setting app? (15sec, 30sec, 1min, 2min, 5min, 10min, 30min)

I am hoping someone can enlighten me. Thanks in advance.

s-t
  • 385
  • 4
  • 14
  • 1
    Why do you need this to begin with? There are other methods of making sure the screen doesn't turn off, such as a wakelock. You should use these instead of changing settings. – Gabe Sechan Aug 18 '14 at 14:33
  • Thanks for comment @GabeSechan. I wanted to not have to keep the app running in between, and I thought wake lock would need the app to be running. I guess I can change the whole thing.. – s-t Aug 19 '14 at 15:32

2 Answers2

2

Did something change in OS?

Yes, AOSP of Kitkat do something.
When it got -1 , it will modify -1 to 15 seconds.

ray.kc.liu
  • 43
  • 10
  • thanks for answer. But.. it dimmed straight away, so it seemed to have set it to 0 sec instead of 15 sec? – s-t Nov 13 '14 at 01:40
0

the Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, -1); work only for api level 19 and below.

Didnt find any thing but a work around may be you can set it to 30days of time(ie infinite time).

user3207655
  • 188
  • 2
  • 15