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:
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.