how to disable screenshot in react native

Solutions on MaxInterview for how to disable screenshot in react native by the best coders in the world

showing results for - "how to disable screenshot in react native"
Lena
29 Oct 2017
1// go to android/app/src/main/java/com/yourPackageName/MainActivity.java
2
3package com.yourPackageName;
4
5import android.os.Bundle; 
6import com.facebook.react.ReactActivity;
7
8// Add This Line
9import android.view.WindowManager;
10
11public class MainActivity extends ReactActivity {
12
13  @Override
14  protected String getMainComponentName() {
15    return "bannermaker";
16  }
17  
18  @Override
19  protected void onCreate(Bundle savedInstanceState) {   
20    super.onCreate(savedInstanceState);
21    // Add this line
22    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
23  }
24}
25