How to Terminate WP8 Application Programmatically?


This small tips & tricks will help you to terminate your running Windows Phone 8 application forcefully. Though this is not a common practice, but you may want this in some scenario. - Article authored by Kunal Chowdhury on .

Though it’s not the common practice in Windows Phone application development, but you may want to terminate your Application programmatically on some special occasions. These occasions may vary in different cases.

 

In this post, we will learn how to kill the application programmatically so that, it should not reside in the memory unnecessarily when user hits back to come out from the application.


 

We all already know that, Windows Phone application stays in the memory and goes to suspended state when user hits hardware back button, start button or the search button. If you are building any banking application or any kind of secure application and wants to terminate the application forcefully when the user hits any one of them, you can use this trick.

 

To terminate the application completely, you just have to call the following API:

 

 
Application.Current.Terminate();
 

 

This will terminate the running application completely and the user will not be able to come back to the app by pressing the hardware back button. The place to call this API may vary depending upon your requirement. But make sure to save important data, if any, before forcefully terminating the application.

Have a question? Or, a comment? Let's Discuss it below...

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.