How to Prevent Screenshot Or Screen Recorder in Android?

Sometimes, we don’t want to allow users to take screenshots or screen recordings of our android application. This is helpful for security issues today so many Android applications prevent Screenshots. In this article, we are going to explain how to prevent Android from taking a screenshot or screen recording.

Prevent taking Screenshot in Android App:

In the file just you need to add the following code and it will prevent taking Screenshot in Android App.


Complete code for the file:

import android.os.Bundle;
import android.view.WindowManager;
public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {

// this will prevent taking screenshot in your app
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);


izmir eskort - mersin eskort bayan - adana eskort - antalya eskort - eskort istanbul
Code Compiler Web Tools Contact