I am trying to find a background task which will get triggered when the user signs out and signs back in. I looked into some of the SystemTrigger types and came across SessionsConnected trigger. My understanding is that this is a system trigger when a session ends and that means this would be triggered on a log out and log back in. Is there a different way to use this trigger for sign in and sign out? Or is there a different trigger to achieve this.
Currently, there are no other UWP APIs that could directly detect the user logging in/logging out. I think the SessionsConnected trigger
that you found does the work in some scenarios.
But if you want to have a separate event for both logging in and logging out actions, then you might need to use the SystemEvents.SessionEnded Event and SystemEvents.SessionSwitch Event . These are.Net APIs that need to be used in desktop apps. So you have to create a desktop app and package the desktop app together with the UWP app using desktop bridge.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.