Disable screenshots in android ics

2019-02-02 21:42发布

问题:

For one of our secure apps, there is a requirement to disable the screenshot capability for the app in Android ICS. Is this possible on a non-rooted device?
Thanks,
Rajath

回答1:

Why don't you add this line in your activity class. This will do the trick.

// This disables screen shot to be taken for current activity
getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);

You may want to have a look at Mark Murphy's blog post.



回答2:

This will never be possible, period end of story. Its also possible for the owner of the device to obtain any encryption keys used by your application by reading memory using a debugger. This can be used decrypt any "sensitive" imagery used by the app.