A NativeScript plugin to protect sensitive content from screen capture and recording.
This plugin provides API methods to block screenshots and detect screen recording events — with native support for both iOS and Android.
npm install @wuilmerj24/screen-protector| Feature | Android | iOS |
|---|---|---|
| Block Screenshots | ✅ | ✅ |
| Block Screen Recording | ✅ | ✅ |
| Detect Screenshots | ❌ | ✅ |
| Detect Screen Recording | ❌ | ✅ |
import { ScreenProtector } from '@wuilmerj24/screen-protector';const protector = new ScreenProtector();
// Block screenshots
protector.lockScreenShoots();
// Optionally set up listeners (iOS only)
protector.setScreenshootEvent(() => {
console.log('📸 Screenshot detected (iOS)');
});
protector.setScreenRecorderEvent((isRecording: boolean) => {
console.log('📹 Screen recording changed:', isRecording);
});protector.unlockScreenShoots();
// Remove observers (iOS only)
protector.removeScreenShootObserver();
protector.removeScreenRecorderObserver();Blocks screenshots and screen recordings:
- On iOS, it uses a secure UITextField to force the system to blur the screen.
- On Android, it sets
FLAG_SECUREto prevent all screen capture mechanisms.
Restores the normal behavior, allowing screenshots again.
iOS only
Registers a listener that fires when the user takes a screenshot.
iOS only
Registers a listener that tracks whether screen recording is active (true or false).
iOS only
Removes the screenshot observer.
iOS only
Removes the screen recording observer.
Apache License Version 2.0
Maintained by @wuilmerj24
Apache License Version 2.0