简体   繁体   English

如何知道UI是否在X时间闲置?

[英]how to know if UI is idle for X time?

I have a servery app. 我有一个服务应用程序。 That ask questions from users. 那提出了用户的问题。 What I want to do. 我想做的事。 If user did not do any thing with UI for the 1 mint... Then I must terminate the server. 如果用户没有为1薄荷用UI做任何事情......那么我必须终止服务器。

What should I do for this? 我该怎么办?

I know ACTION_SCREEN_OFF. 我知道ACTION_SCREEN_OFF。 This event actually called when screen time out. 屏幕超时时实际调用此事件。 That may be 30 mint? 那可能是30薄荷? depend on user setting. 取决于用户设置。 But let suppose user set time out for 30mint. 但是假设用户设置超时30分钟。 and this event will call after 30 mint. 这个事件将在30薄荷之后调用。 But I want to know if UI is idle for 1 mint only. 但我想知道UI是否只闲置一分钟。

通常,我在我的代码中安装SCREEN_OFF广播监听器(不是作为清单条目,只是一个动态监听器)...如果它被触发,那么我知道用户已经闲置,只要它们的定义“太长”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM