Search code examples
windows-phone-8.1windows-store-apps

App Termination Event WP8.1


I am developing a WP8.1 app in which I need to get the time when app terminated so that when it's launched again I can take decisions according to my requirements. But for this I'm unable to find the any kind of termination event for app where I can store the time of app termination. I have searched and have found Windows Phone 8.1 App Life Cycle which shows there is no event for termination. So my question is how can I record the time of app termination?


Solution

  • You can handle the suspension of the application, when it is brought to the background, and record that time. It is the time when the user last used your app, so when it is started again, you can check how much time has elapsed since last use.

    For the actual termination you do not receive an event, nor it is a way to handle such event, because all processing in the application is stopped when suspended and no code can execute.