How do I disable screenshot when my app is running on an android device? Is there any way to prevent someone from taking a screenshot?
Use Flag Secure as a layout parameter flag.
In the onCreate()
method, add the flag
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,WindowManager.LayoutParams.FLAG_SECURE);
before setContentView();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With