2

I'm planing to start a UWP application that monitor a sensor data for 365 days and save all data to database(Sqlite).

I still worry about UWP capability. Please advice me Which should I use (UWP/WPF) ? I want to use better UI, than, I want to use UWP if possible...

UWP-Suspending is my worry.

With this post, Some people said a way to prevent a UWP application from suspending..

var extendedExecutionSession = new ExtendedExecutionSession();
extendedExecutionSession.Reason = ExtendedExecutionReason.Unspecified;
var extendedExecutionResult = await         extendedExecutionSession.RequestExtensionAsync();
if (extendedExecutionResult != ExtendedExecutionResult.Allowed)
{
//extended execution session revoked
     extendedExecutionSession.Dispose();
     extendedExecutionSession = null;
}

Question

If I wrote this code in UWP app, Can I use a UWP application like Desktop WPF application ? I want to run my UWP application for 365 days without stopping .. even if user do "minimized" on desktop... Please advice it...

Kazuhiko Nakayama
  • 801
  • 1
  • 8
  • 24

1 Answers1

7

Yes, you can do that with ExtendedExecution. One thing to note is when you run on battery (e.g. laptop, tablet) you will get suspended after some time - however you can prevent that as well by going into the Battery settings page and set your app as "Always Allowed".

Details are documented here: https://learn.microsoft.com/en-us/windows/uwp/launch-resume/run-minimized-with-extended-execution

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
  • Do you mean that session revoke will NOT occur on AC-Powered PC? – Mamoru Satoh Jul 27 '17 at 06:10
  • There is no execution time limit when the PC is plugged into power, so you won't get revoked for that reason. You should still handle the event in case the session is revoked for other reasons. – Stefan Wick MSFT Jul 27 '17 at 14:06