0

Info

My UWP app will allow users to control their PC's cursor wirelessly from their phone via a socket connection. Since the app acts as the user's mouse, it must be "always on" to react when socket data is received and move the mouse.

Reading into the app lifecycle, it doesn't seem possible to keep the app constantly running. Since the app will be in the background, it could be suspended or terminated at any point (since the system thinks its not currently being used), and the overhead from socket brokers may cause unwanted delay in responsiveness.

Question

Is there a solution within UWP so I can continue using it (eg. keeping the app running / good enough socket brokers), or is it worth moving to Win32 to meet the requirements?

dwb
  • 2,136
  • 13
  • 27
  • 1
    Does this answer your question? [How to Disable UWP App Suspension?](https://stackoverflow.com/questions/47339719/how-to-disable-uwp-app-suspension) – Dai Oct 10 '20 at 14:02
  • UWP is **not** a good platform for anything that isn't a media-consumption application - especially a system-utility application like yours. Why did you choose to use UWP in the first place? – Dai Oct 10 '20 at 14:03
  • @Dai Just because I wanted to try something new really :D If you've got any sources for your second comment and include it in an answer I'll mark it, since that's essentially the feedback I was looking for (and sort of expecting too ;) ) – dwb Oct 10 '20 at 14:26
  • 2
    UWP's application model provides background tasks for patterns like this. You *can* write a UWP application that will constantly respond to network data arriving. Though with Windows 10 Mobile gone, there's not much of a reason to target the UWP. Ignoring Xbox and HoloLens you're really just targeting Windows (desktop). I suppose writing a classic Win32 application is a better fit. If you still want to try something new, you can access the Windows Runtime API from a Win32 application just fine. – IInspectable Oct 10 '20 at 16:16

0 Answers0