Arbaz.in
Arbaz.in

Reputation: 1558

How do I prevent screen video recording in android application?

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);

Upvotes: 2

Views: 7383

Answers (2)

Prakash Dubey
Prakash Dubey

Reputation: 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)

Upvotes: -1

prashant0205
prashant0205

Reputation: 279

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

Upvotes: 6

Related Questions