UWP Background Task for keypress in XBOX

Alper 0 Reputation points
2023-05-29T11:43:12.7733333+00:00

I need a way to detect when XBOX Series S controller is grabbed. When the controller is taken, I will call a service.

I have tried accelerometer for XBOX controller, but it did not work. So I tried to listen for keypress events from any controller. This works for foreground window in the MainPage.xaml.cs.

But I need this UWP app to run continuously in the background. As soon as the controller key pressed (which means under 1 second), I need to run call some service.

So is there any background trigger like DeviceUseTrigger to handle this case or

must I use extendedBackgroundTaskTime as described here: https://learn.microsoft.com/en-us/windows/uwp/launch-resume/run-in-the-background-indefinetly

This app must be started with the XBOX startup and must be alive as long as the device is open.

Is this app can be cancelled by XBOX OS? If so how can be restarted automatically?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
43,924 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.