Screenshot protection
// When the sensitive screen opens:final result = await DeviceShield.setScreenshotProtection(true);
// When it closes:await DeviceShield.setScreenshotProtection(false);result is ProtectionResult.applied once the protection is in effect,
failed if there’s no window yet (call it again once your UI is showing),
and unsupported where the platform has none.
Android
Section titled “Android”The SDK sets FLAG_SECURE on your activity’s window. The operating system
then:
- saves screenshots as a black image,
- shows black in screen recordings and casts, and
- hides the app’s thumbnail in Recents.
Verified on an Android 17 emulator (API 37): with protection on, both a
system screenshot and adb screencap come out black, including after
rotating the device.
App-switcher protection uses the same flag. The two are tracked separately: the flag stays set while either one is on.
On iOS, pair it with screenshot detection and app-switcher protection rather than relying on it alone.