How to Terminate WP8 Application Programmatically?


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.


If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter, Facebook, Google+ and LinkedIn. I would love to hear your thoughts and opinions on my articles directly. Also, don't forget to share your views and/or feedback in the comment section below.

0 comments

 
© 2008-2016 Kunal-Chowdhury.com - Microsoft Technology Blog for developers and consumers | Designed by Kunal Chowdhury
Back to top