Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I detect user screenshots, without screenshot_callback [no duplicate]

Tags:

flutter

dart

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.

like image 548
tims Avatar asked Nov 07 '22 03:11

tims


1 Answers

try this package

import 'package:screen_capture_event/screen_capture_event.dart';

 listenScreenShot() {
   screenListener.addScreenShotListener((filePath) {
     print("fresh screenshot!");
   });
   screenListener.watch();
 }
like image 105
Igor Avatar answered Nov 26 '22 12:11

Igor