Programmatically disable screen timeout

前端 未结 2 675
轻奢々
轻奢々 2021-01-22 06:38

From this post, Android disable screen timeout while app is running, I can disable screen timeout by

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSC         


        
2条回答
  •  时光取名叫无心
    2021-01-22 07:06

    Do you just want the screen to time out after you've closed your application? Or is something inside your application going to reset the screen timeout so that it will happen even while your app is running?

    If the former I don't think you need to do anything, when you're app is stopped the screen timeout will return to normal.

    If the latter it seems like the snippet you've provided would do the trick. But I have no experience with it so I couldn't be certain.

提交回复
热议问题