Prevent the back button from closing the application


I am using Nativescript with Angular on Android. I have read that the application closes if I press the back button when the navigation stack is empty. However, I have done some experiments and what I see is that the application goes to background (ngOnDestroy is not called), but there doesn’t seem to be any way for me to resume it. If I click on the app icon, a new instance of the application is launched. I don’t want multiple instances of my application. Is it possible to configure the back button to just “minimize” the application (like when I press the home button)? Or, how can I resume the one that is running on the background?

Btw, I have also tried with:


but the back button still “half-closes” my application.

Is this the expected behavior? a bug? a matter of configuration?

Any help is appreciated. Let me know if I should include a sample code.




Ok, treating the back event as a home event solves the problem:

How to do it in Nativescript: