Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arahmanali/66a22f83cfa0a0157024450cc6eddd91 to your computer and use it in GitHub Desktop.
Save arahmanali/66a22f83cfa0a0157024450cc6eddd91 to your computer and use it in GitHub Desktop.
React Native Prevent Screenshot In Android - Update MainActivity.java
package com.stopscreenshotapp;
import com.facebook.react.ReactActivity;
import android.os.Bundle;
import android.view.WindowManager;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "stopScreenshotApp";
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment