0

I am able to suspend and resume the UWP application using visual studio Life cycle events. But when I tried with User's machine I am unable to get the suspend and resume state of the application.

I tried using resource monitor to suspend and resume the process , but it is not hitting "Onsuspend" event, while on resuming it is not hitting "OnResume" event.

Is there any other way to hit the OnResume event in the application?

Vishnu s
  • 261
  • 2
  • 18
  • The User's machine is desktop or mobile? – Romasz Jun 15 '17 at 08:01
  • It is a desktop. – Vishnu s Jun 15 '17 at 08:07
  • 1
    How do you test the User's machine (minimalizing/changing app)? Have you tried to monitor [Entering/LeavingBackground events](https://learn.microsoft.com/en-us/windows/uwp/launch-resume/app-lifecycle)? – Romasz Jun 15 '17 at 08:15
  • Ya I have log for each event like entering background, leaving background, On activated event, On suspend event. – Vishnu s Jun 15 '17 at 08:56
  • When you are on desktop, the OS doesn't suspended it easily because you have plenty of resources to use. So, it doesn't hit "OnSuspended". As @Romasz said, use EnteredBackground and LeavingBackground events – Raamakrishnan A. Jun 15 '17 at 10:47

2 Answers2

2

When running outside of the debugger on a desktop machine you can just minimize the app to the taskbar to trigger the OnSuspending event. Then restore it back from the taskbar to trigger the OnResuming event.

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
2

We can make the Application to go suspend and resume state in tablet mode.

Change the OS to tablet mode(we can change it in action center). In the tablet mode only fore ground application will be in running state. All other UWP applications in the background will be in "Suspended state". When we make those application to fore ground it will come from "Suspend state" to "Resume state".

Vishnu s
  • 261
  • 2
  • 18