6

I asked this question before but I got closed. Because it is a duplicate, but it isn't. I don't want to disable screenshots I only want to detect screenshots. So this question is not a duplicate of  Flutter: disable screenshot capture for app

I currently run into a problem I tried to detect if a user is taking a screenshot. So I found this package screenshot_callback, but it didn't work, I used the example file of the package and nothing happened when taking a screenshot. I tried it on my android emulator and on my phone, it didn't work on both of them So I wrote an issue report on git but no one answered.

So I was wondering is there any way to detect a user screenshot without using this package, I couldn't find any way to do so, but maybe someone else knows the answer.

I use Flutter/Dart.

tims
  • 512
  • 3
  • 14
  • 1
    Found something ? – nicover Jul 21 '21 at 09:33
  • @nicover No not really, I compromised by completely blocking screenshots on one specific page like this: https://stackoverflow.com/questions/65389302/how-to-block-screenshots-in-flutter-on-only-one-page maybe this helps you. If not I opened an issue about the topic ages ago, maybe there is something new that helps you: https://github.com/flutter-moum/flutter_screenshot_callback/issues/33 – tims Aug 03 '21 at 18:58

1 Answers1

1

try this package

import 'package:screen_capture_event/screen_capture_event.dart';

 listenScreenShot() {
   screenListener.addScreenShotListener((filePath) {
     print("fresh screenshot!");
   });
   screenListener.watch();
 }
Igor
  • 399
  • 4
  • 18
  • I saw it is mentioned in the example code that the screenshot is only available for Android but it also writes iOS in the platform section of the package. Do you know whether it is also available for iOS to detect screenshot also?. Thanks – Hoangdz Apr 05 '22 at 11:40
  • yes, its available for both IOS and Android – Igor Apr 05 '22 at 18:04