Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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);
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #disable #screenshot #react #native
ADD COMMENT
Topic
Name
7+6 =