1

I have been testing a C# Companion Device Framework application, which unlocks my laptop fine for the most part. However, it doesn't seem to work after I leave my laptop locked for a while.

I used the code from the CDF GitHub sample to fire a toast notification when the background task for my UWP companion app is triggered. This shows me that there is never an issue when I attempt an unlock shortly after locking the machine. When I lock my machine, I immediately see the toast notification indicating that the background task was triggered. However, if I lock my laptop and leave it for a few minutes, it doesn't appear that the background task gets triggered again, even though I wake up the screen and press buttons.

I want my CDF app to always be able to unlock my machine. What did I do wrong? Hopefully I don't need it, but is there a workaround like registering a second trigger for the background task to a custom service?

UPDATE: It appears this occurs only if the computer does not go to sleep, which may occur in the case that someone has either set a long time before sleep or has sleep off completely (as I did previously). If the laptop does go to sleep, and has to be woken up with a trackpad click, then the background task seems to fire.

ZX9
  • 898
  • 2
  • 16
  • 34

1 Answers1

0

The problem is, Windows UWP stops to fire the event WaitForUserConfirmation after awhile.

At present, we have 2 possible solutions:

  1. user hits the keyboard and the background task catches the event CollectingCredential and invokes the companion device authentication
  2. once the background task is running, it loops until the event CredentialAuthenticated, and it runs the companion device authentication periodically.