Screen on/off detection

前端 未结 4 1144
遥遥无期
遥遥无期 2021-02-14 02:07

here i am trying to determine whether the screen is on or not but it doesn\'t seems to be working when press power lock/unlock button. Application works with no error but the co

4条回答
  •  醉酒成梦
    2021-02-14 02:12

    Register your BroadcastReceiver in a backgroung Service for Intent.ACTION_SCREEN_ON and Intent.ACTION_SCREEN_OFF events. It worked for me.

提交回复
热议问题