Answers for "prevent screenshot react native"

0

how to disable screenshot in react native

// go to android/app/src/main/java/com/yourPackageName/MainActivity.java

package com.yourPackageName;

import android.os.Bundle; 
import com.facebook.react.ReactActivity;

// Add This Line
import android.view.WindowManager;

public class MainActivity extends ReactActivity {

  @Override
  protected String getMainComponentName() {
    return "bannermaker";
  }
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {   
    super.onCreate(savedInstanceState);
    // Add this line
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
  }
}
Posted by: Guest on July-11-2021

Code answers related to "prevent screenshot react native"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language