且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

检测手势电话睡眠

更新时间:2022-10-15 14:53:31

如果屏幕处于关闭状态(即在待机),硬件也不会记录任何触摸事件,所以你问什么(检测屏手势)是不可能的。当设备进入待机/睡眠,触摸屏实际上是关机以节省电池电量。你能做的***的是检测不唤醒屏幕的动作,例如硬件按钮中的一个。

If the screen is off (i.e. in standby), the hardware will not register any touch events so what you have asked for (detecting screen gestures) is not possible. When the device goes to standby/asleep, the touch screen is effectively shutdown to conserve battery power. The best you can do is detect an action that does wake the screen, e.g. one of the hardware buttons.

另外,如果你想检测你的应用程序触摸事件,该装置将需要与在前台您的活动。如此反复,屏手势是一个非首发为SOS类型的应用程序。

Also, if you wanted to detect touch events for your app, the device would need to be on with your activity in the foreground. So again, screen gestures are a non-starter for an SOS type app.