locked
Migrate Win 8.1 Update Issue: Modern app with background task was shutdown when put to background

    Question

  • my pc automatically update to Windows 8.1 Update, after that, my application fails to live in the background as long as it suspends by system.

    Details:

    My app uses background task to do some data-transfer when my modern app are putted into background, it was a windows 8 program, but it works well on Windows 8 & Windows 8.1;

    But when my os update to "Windows 8.1 Update", once I put my modern app into background, the app was soon shutdown.

    I simulate this process using Visual Studio, and use 'Suspend' to put my app into suspend state, and the "OnSuspending" was sucessfully handle, but then the program was soon shutdown.

    But no exeption or error pop-up for me to debug.

    So, is there any changes in Windows 8.1 Update ? Do I have to change my code to fit the os changes ?

    Thanks so much.


    programmer

    Thursday, April 17, 2014 1:19 AM

Answers

  • Termination has always been a part of the post-suspend lifecycle for Windows Store apps.  Please review this blog post overview:

    http://blogs.msdn.com/b/mspfe/archive/2013/06/17/suspend-and-resume-in-winrt.aspx

    While your app runs, the end user can move their attention to another app which sends your app to the background. In that case, after 10 seconds, Windows notifies your app via the Suspending event that its threads won’t be scheduled in 5 seconds. If the user switches back to your app, it will be woken-up by Windows and a Resuming event will be received. Note that while your app is suspended, Windows can decide to terminate it due to memory pressure from other applications. In that case, your app won’t be notified of this termination because it is suspended. However, the arguments sent to the app the next time it is activated provides the necessary details to figure out that it was terminated.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, April 17, 2014 1:33 PM
    Moderator