How to Disable UWP App Suspension?

前端 未结 5 520
滥情空心
滥情空心 2021-01-18 22:03

I am using C# to develop a UWP app for Windows 10 running only on desktop computers, targeting platform version 10.0.14393.0. Due to business requirements, the app lifecycle

5条回答
  •  野的像风
    2021-01-18 22:22

    Use Visual Studio debug mode to run the app, and the app will never run into a suspended state. It is kept awakened by Visual Studio.

    Ahh, this is just a joke.

    I think unfortunately what you expect is a behavior that is in contradiction to the design principles of UWP.

    The system reserves the right to suspend a background app after some “deferal”. If you request an extended execution session, you have to prepare for the revocation as well, being connected to wall power does not keep the app running forever.

    Option 1 is resort to desktop app, though this may not be an option. If you get this requirement because users like UWP but doesn’t like the idea of “suspended” (What the... suspended??), I am afraid you cannot fulfill this requirement.

    Option 2 is... is there any real task that has to be kept running even the app is switched to the background? If the task needs to run periodically, like checking inbox of a mail account, you can use some kind of timer triggered background task.

    Option 3: Think about kiosk mode, there is only one app allowed to run on the device, so it cannot be possibly switched to the background and put into suspension.

提交回复
热议问题