How to reveal that screen is locked?

后端 未结 3 2155
日久生厌
日久生厌 2020-12-28 10:35

In my application I need to know when device is locked (on HTC\'s it looks like short press on \"power\" button). So the question is: which event is triggered when device is

3条回答
  •  盖世英雄少女心
    2020-12-28 10:41

    In addition to the above answer, in-case you want to trigger some action when your app is at the foreground:

    You could use the event called onResume() to trigger your own function when your app takes the spotlight from a previously resting state, i.e, if your app was at the background(paused/minimized...)

    protected void onResume()
    {
        super.onResume();
    
        //call user-defined function here
    }
    

提交回复
热议问题