Flutter: disable screenshot capture for app

后端 未结 6 1012
日久生厌
日久生厌 2020-12-14 10:48

I am making a Flutter app and I need to make sure the user is not able to capture screenshot of the app (any screen). Is there any way to achieve this in Flutter or do I nee

6条回答
  •  一向
    一向 (楼主)
    2020-12-14 11:43

    1. Locate your MainActivity class inside the embedded android project dir in your Flutter Project
    2. Add the following import to your main activity class: import android.view.WindowManager.LayoutParams;
    3. Add the following line to your MainActivity's onCreate method: getWindow().addFlags(LayoutParams.FLAG_SECURE);

提交回复
热议问题