Detecting When an App Is Suspended and Terminated

You can detect when an app is suspended by handling the WinJS.Application.checkpoint event. You should use this event to save the state of your app so you can reload the state when the app starts again.

There is no method within a Windows Store app to detect when an app is terminated. In particular, there is no app terminated event. For this reason, if you need to save the state of your app so the state can be reloaded after termination, then you should save your app state during the checkpoint event.

Here’s some sample code for handling this event:

WinJS.Application.addEventListener("checkpoint", function () {    // Save app state});

Note

Creating an app terminated ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.