Programmatically disable screen timeout

前端 未结 2 676
轻奢々
轻奢々 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:15

    Yes, that will work - it's how I do it in PocketSat3, though I don't toggle FLAG_FULLSCREEN (of course, that said - that app doesn't use FLAG_FULLSCREEN...)

    Unlike using WakeLock, doing it this way doesn't require any permissions - though I have to admit it's not completely clear to me that is a Good Thing.

提交回复
热议问题