📜  如何在 React Native 中禁用屏幕截图 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:18.401000             🧑  作者: Mango

代码示例1
// 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);
  }
}