Reputation: 53
I need to block a screen capture and display a dialog box for the user when trying to capture a screenshot. Here I can only block the user from taking a picture of the screen but it is difficult to access the user when taking a picture of the screen.
if (android.os.Build.VERSION.SDK_INT >=
android.os.Build.VERSION_CODES.HONEYCOMB) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE);
}
How do I show a dialog box containing a message to the user when taking a picture of the screen?
Upvotes: 1
Views: 263
Reputation: 1006664
Sorry, there is nothing in Android to allow you to detect a screenshot, let alone display alternative content. Your options are to block portions of your UI using FLAG_SECURE
(as noted in your question) or not.
Upvotes: 1