2

I want to know how to detect user idle in UWP. I mean not the case user idle for the app, but for the whole system/OS: no keyboard input, no mouse operation, no touch even when no focus on the app or app is minimized.

I find some other post about it. Like this: How to check if user is idle on UWP? And it uses below method:

Window.Current.CoreWindow.PointerMoved += onCoreWindowPointerMoved;

I tested and found that if my mouse moves outside of the app window, then onCoreWindowPointerMoved() will not be executed. It means this method can not detect user idle on the whole system.

Tom Xue
  • 3,169
  • 7
  • 40
  • 77

1 Answers1

1

How to detect user idle in UWP?

For security reason, we could not implement this in UWP platform, But we could implement this in legacy win32 app, and use FullTrustProcessLauncher to run the win32 app to detect the system idle. then use AppService pass the status to UWP app. For more please refer this tutorial

Nico Zhu
  • 32,367
  • 2
  • 15
  • 36
  • I roughly checked the link, good solution for me. Another question is the "Desktop Extension" executable program is made by developer himself, right? If yes, then the UWP app can be put on Micorosoft App Store, but how about the "Desktop Extension" program? If only the UWP can be published on App Store, then it cannot work well on user's computer without the "Desktop Extension" program, right? Really thanks for your many times help! – Tom Xue Nov 04 '19 at 10:22
  • Please check the code sample in above tutorial, the desktop extension is part of your app, and you need create it by-self and then use desktop bridge pack them together. it could be published to store. – Nico Zhu Nov 04 '19 at 10:30