setScreenCaptureProtection method

Future<void> setScreenCaptureProtection(
  1. bool enabled
)

Hides the app from screenshots, screen recording and the recent-apps preview while enabled (FR-FAC-06): Android FLAG_SECURE on the current activity, kept across activity re-creation.

iOS and the web cannot block screenshots; there this does nothing, and capabilities.screenCaptureProtection is false, so apps can explain it or blur their own snapshot. It does not stop a camera pointed at the screen or a rooted device.

Implementation

Future<void> setScreenCaptureProtection(bool enabled) async {
  _checkOpen();
  await _platform.setScreenCaptureProtection(enabled);
  _log(
    MfaLogLevel.info,
    'screen capture protection ${enabled ? 'on' : 'off'}',
  );
}