Skip to content

Instantly share code, notes, and snippets.

@danikx
Created April 9, 2018 08:55
Show Gist options
  • Save danikx/46b00054be062756e019b602eafe9e9c to your computer and use it in GitHub Desktop.
Save danikx/46b00054be062756e019b602eafe9e9c to your computer and use it in GitHub Desktop.
Prevent screen capturing is way for saving your content.
Android SDK have special flag for it.
https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SECURE
Just declare it in your Activity like this:
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
.....
}
@danikx
Copy link
Author

danikx commented Apr 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment