So I have used following code to block to take screenshot
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
It is work fine on physical device but Android Studio Emulator is allow to take screenshot
So I have used following code to block to take screenshot
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
It is work fine on physical device but Android Studio Emulator is allow to take screenshot
Even if you made that particular button not work, there is no way to prevent the computer OS from taking a screenshot of an emulator it is running, but you could prevent your app from running on an emulator with high probability. See: How can I detect when an Android application is running in the emulator?
If you still want to be able to do development on an emulator you could choose to only apply the emulator check in release builds.