The app I\'m currently building has the requirement that the app has to prevent the OS to take a screenshot of the app when it\'s being pushed into the background for securi
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
this worked for me, it prevents from taking screenshot and also any inbuilt or third party recording application from recording screen.