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