locked
Application Does Not Receive a Suspend Notification When Closed RRS feed

  • Question

  • Hello there

    I have a JavaScript based Windows store application, and cannot get my data reliably saved when the application is closed.

    If the application is suspended, I am OK, since I respond to the “checkpoint” event by saving my data, which I subsequently restore when the application is activated or resumed.

    If, however, I close my application using Alt F4, there seems to be a delay of about 10 seconds before the suspend notification is sent.  If I click on my application’s tile during that time, my application is activated and the data is lost.

    Any suggestions would be appreciated.

    Geoff Olding

    Friday, October 12, 2012 9:55 PM

Answers

  • If the user closes the app (e.g. ALT+F4/top-down gesture, etc.) and then immediately starts the app (< 10 secs I believe) then the first instance is force killed to get the user back to a clean state, which means it is possible that you don't receive the suspending event during that time if the app was killed before it got triggered.

    The easiest solution is to handle the document.visibilitychange event and checkpoint there as well so that you get called during close.

    Saturday, October 13, 2012 1:31 AM

All replies

  • If the user closes the app (e.g. ALT+F4/top-down gesture, etc.) and then immediately starts the app (< 10 secs I believe) then the first instance is force killed to get the user back to a clean state, which means it is possible that you don't receive the suspending event during that time if the app was killed before it got triggered.

    The easiest solution is to handle the document.visibilitychange event and checkpoint there as well so that you get called during close.

    Saturday, October 13, 2012 1:31 AM
  • Many thanks for your help - this does work
    Saturday, October 13, 2012 11:09 AM