How can I keep my screen on using a background running app?

前端 未结 1 1898
梦谈多话
梦谈多话 2021-01-28 10:28

I need to make an app that keeps the screen on even when the app is running in the background.

I\'ve tried:

    getWindow().addFlags(WindowManager.Layout         


        
1条回答
  •  别那么骄傲
    2021-01-28 11:11

    The response is no, you can't. As you said the only way of doing that is using deprecated api. As alternative you could use an activity with transparent theme but if the user for example press the home button and the activity is no more in foreground you loose anyway.

    0 讨论(0)
提交回复
热议问题