Tuesday, August 18, 2015

Windows Phone kill application everytime

Problem:


One issue I have with a windows application is application lifecycle.  I need to make sure that the app is terminated each time a user leaves the app.  The app can be Closed or deactivated.  The deactivation can leave the app running in the background.

 

Solution:

Add the following code block to the App.xaml.cs at the root level of your windows phone project.
Locate the method Application_Deactivated.

private void Application_Deactivated(object sender, ClosingEventArgs e)
{
      App.Current.Terminate();
}

No comments:

Post a Comment