locked
Difference Between Closing An App by Using Alt+F4 and Close Gesture

    Question

  • Is there a difference between closing an app by hitting Alt+F4 and dragging it to the bottom of the screen? I want OnSuspending method to run when my store app is closed by users. If Alt+F4 is used, it works fine. However, in case of closing the app by dragging it or clicking the red cross button at the top-right of the screen, OnSuspending method is not called, which made me think that closing an app by hitting Alt+F4 or by dragging it doesn't mean the same thing. Am I wrong? If not, what is the reason? Thank you.
    Thursday, January 29, 2015 10:21 PM

Answers

  • Hi Hvarlik,

    Per my understanding, there is no difference between closing app using Alt+F4 or close gesture. They are making the app suspended and terminated.

    >> OnSuspending method is not called, which made me think that closing an app by hitting Alt+F4 or by dragging it doesn't mean the same thing.

    If you want to debug suspending event, you need to debug suspending, use the lifecycle evnets in your visual studio like the following image.

    If you want to do something according to closed-by-user behavior, you can use ApplicationExecutionState enumeration. You can find more information about this behavior from https://msdn.microsoft.com/en-us/library/windows/apps/hh464925.aspx#close. See App Close section.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Monday, February 9, 2015 3:28 AM
    Moderator

All replies

  • These subtle differences should not matter to your app.

    When should put your app go to suspend is an os decision. If it does not happen at times you want to execute some codes.

    You probably need to look for a different event to perform your task


    • Edited by hereafter Friday, January 30, 2015 12:23 AM
    Friday, January 30, 2015 12:23 AM
  • Hi Hvarlik,

    Per my understanding, there is no difference between closing app using Alt+F4 or close gesture. They are making the app suspended and terminated.

    >> OnSuspending method is not called, which made me think that closing an app by hitting Alt+F4 or by dragging it doesn't mean the same thing.

    If you want to debug suspending event, you need to debug suspending, use the lifecycle evnets in your visual studio like the following image.

    If you want to do something according to closed-by-user behavior, you can use ApplicationExecutionState enumeration. You can find more information about this behavior from https://msdn.microsoft.com/en-us/library/windows/apps/hh464925.aspx#close. See App Close section.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Monday, February 9, 2015 3:28 AM
    Moderator