3

I want to prevent my android application from screen video recorder.

I tried this but this code prevent only screen shot not video recorder.

getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,WindowManager.LayoutParams.FLAG_SECURE);

Abhishek Patel
  • 4,280
  • 1
  • 24
  • 38
Arbaz.in
  • 1,478
  • 2
  • 19
  • 41

2 Answers2

6

Following code prevents screen capturing but certainly not to full extent. See the links below.

getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE); 

check this link and these answer1 and answer2

Community
  • 1
  • 1
prashant0205
  • 269
  • 1
  • 3
  • 17
-1

In Java you can write above your setContentView(R.layout.activity_main);

getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);

& in kotlin you can write it as

window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)