如何在抖动中检测用户屏幕截图动作?

时间:2019-12-23 08:15:13

标签: android ios flutter

如何检测用户是否正在创建屏幕截图?

我不在乎捕获的图片,我只想知道用户何时何地创建sreenshot

如何在Flutter应用中检测到这一点?

2 个答案:

答案 0 :(得分:-1)

您可以尝试使用该插件,它可能是您正在寻找的插件:https://pub.dev/packages/screenshot_callback

为了完成您在自述文件中寻找的内容,

import 'package:screenshot_callback/screenshot_callback.dart';

ScreenshotCallback screenshotCallback = ScreenshotCallback();

screenshotCallback.addListener(() {
  //Void funtions are implemented
  print('detect screenshot');
});

答案 1 :(得分:-2)

尝试 https://pub.dev/packages/screenshot_callback

依赖关系: screenshot_callback:^ 1.1.3

 void init() async {
await initScreenshotCallback();

}

//必须在授予权限后创建。

 Future<void> initScreenshotCallback() async {
screenshotCallback = ScreenshotCallback();

screenshotCallback.addListener(() {
  setState(() {
    text = "Screenshot callback Fired!";
  });
});

screenshotCallback.addListener(() {
  print("We can add multiple listeners ");
});

}