detect_screenshot 2.0.1 copy "detect_screenshot: ^2.0.1" to clipboard
detect_screenshot: ^2.0.1 copied to clipboard

Detect screenshots and screen recording on Android and iOS, block capture with FLAG_SECURE, and hide sensitive content in the app switcher.

2.0.1 #

  • updated readme

2.0.0 #

Refactors the public API to improve naming consistency. All the API functionalities stays the same A major bump because ^1.0.0 would otherwise pull these in automatically and break existing code.

Renamed

1.0.2 2.0.0
screenshotSupport() checkScreenshotListenerSupport()
screenRecordingSupport() checkScreenRecordListenSupport()
appSwitcherPrivacySupport() checkAppSwitcherPrivacySupport()
listenScreenshots() listenForScreenshots()
listenScreenRecording() listenForScreenRecordings()

1.0.2 #

  • updated readme

1.0.1 #

  • updated readme

1.0.0 #

Initial release.

Detection

  • Screenshot detection on iOS, on Android 14+ through Activity.ScreenCaptureCallback, and on Android 7–13 through filtered MediaStore observation.
  • Screen recording detection on iOS and Android 15+, as a stream independent of screenshots.
  • checkScreenshotListenerSupport() and checkScreenRecordListenSupport() report whether a device can detect at all, so a silent stream is never ambiguous.
  • Every screenshot event carries the source that produced it, for segmenting analytics by tier.
  • MediaStore events are filtered on directory rather than file name, on DATE_ADDED recency, on row identity, and on the app being in the foreground.
  • On iOS, capture state is read from the scene's sceneCaptureState. Both push mechanisms Apple offers are registered and neither is trusted: a 500ms poll backs them up while a listener is attached, emitting only on change.

Blocking and privacy

  • android.setScreenshotBlocked() toggles FLAG_SECURE, with android.isScreenshotBlocked() reading the window flag back.
  • ios.setCaptureShield() keeps the app's pixels out of screenshots and recordings and leaves a placeholder image in their place, without changing the live screen. Built on undocumented UIKit internals; it fails open, so a future iOS that breaks it shows real content rather than breaking the app.
  • captureShieldOverlay() renders a widget to PNG bytes for use as that placeholder.
  • setAppSwitcherPrivacy() covers the app in the task switcher: a native overlay on iOS, setRecentsScreenshotEnabled on Android 13+.
  • HideWhileCaptured swaps a subtree for a replacement widget while the screen is being recorded.

API

  • Calls that work on both platforms sit on the detector. Platform-specific ones live under .android and .ios, and are harmless no-ops on the other platform, so no Platform.isIOS guards are needed.
  • listenForScreenshots() and listenForScreenRecordings() return a DetectionListener with dispose(); the raw streams stay available for composing.
0
likes
160
points
191
downloads

Documentation

API reference

Publisher

verified publisherkasuncreations.com

Weekly Downloads

Detect screenshots and screen recording on Android and iOS, block capture with FLAG_SECURE, and hide sensitive content in the app switcher.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, meta

More

Packages that depend on detect_screenshot

Packages that implement detect_screenshot