Make the app private when shown in Android task switcher in NativeScript

Many times we need to hide the information of the app when in task switcher. We can do so using the following code in Android:

var activity = application.startActivity;
activity.getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_SECURE);

Just call the above code in your pageloaded event.