0

I've got an education flutter iOS app. and I want to prevent users to take screenshots or screen records on a specific screen and how to make it

I'm trying many solutions here but no one is working

as attached below, it is a screen record form my iPhone from another app it still records till I reach to specific screen and push me back and showing me this alert dialog how to achieve this feature

Screen Record

  • Does this answer your question? [How to disable screen Recording in iOS app](https://stackoverflow.com/questions/53880491/how-to-disable-screen-recording-in-ios-app) – ohglstr May 25 '22 at 20:45
  • Does this answer your question? [Prevent screen capture in an iOS app](https://stackoverflow.com/questions/18680028/prevent-screen-capture-in-an-ios-app) – Andrew May 25 '22 at 21:56
  • no, I'm trying both and not working – Saayeed M Daawoud May 26 '22 at 05:40

2 Answers2

0

The simplest way to do this is to use a flutter package called flutter_windowmanager

Works only for Android, not for IOS!

First import its latest version in pubspec.yaml file of your Flutter project and run pub get. Then add the below code inside the widget's initState() method for which you want to disable screenshot and screen recording.

Future<void> secureScreen() async {
    await FlutterWindowManager.addFlags(FlutterWindowManager.FLAG_SECURE); 
 }

 @override
 void initState() {
    secureScreen();
    super.initState();
 }

 @override
 void dispose(){
    super.dispose();
    await FlutterWindowManager.clearFlags(FlutterWindowManager.FLAG_SECURE);
 }

If you want to make your whole app screenshot disable just call securescreen() method (defined above) inside your main() function in main.dart file.

Moritz
  • 176
  • 1
  • 9
0

Use this if you don't want users to take screenshots in your app. flutter_windowmanager

By using this package, you can add many more functionality like blur app when its in background, force full screen, dismiss keyguard.

Read the dicumentation for more info.