通过idleThreshold=10;(秒)

userIdle、userPresent事件

可以对用户离开状态和返回状态进行处理.

例如QQ的5分钟没有鼠标键盘动作,进入离开状态, 有了鼠标键盘动作就回到在线状态.

 

NativeApplication.nativeApplication.idleThreshold = idleTime;
NativeApplication.nativeApplication.addEventListener(Event.USER_IDLE,onIdle);
NativeApplication.nativeApplication.addEventListener(Event.USER_PRESENT,onPresence);

 

自己定义一下事件处理函数就好了,避免了以前用Timer处理的麻烦事儿~~

相关文章:

  • 2022-01-22
  • 2021-05-30
  • 2022-12-23
  • 2021-11-29
  • 2021-06-05
猜你喜欢
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
  • 2021-04-05
  • 2022-12-23
相关资源
相似解决方案