Mobile Screenshots
Eser Deniz
NativePHP^3.0iOS17.0+Android26+
Screenshot and screen recording control for NativePHP Mobile — block captures, detect attempts in real-time, and take programmatic screenshots.
Features
- Block screenshots and screen recordings (
FLAG_SECUREon Android; privacy overlay on iOS) - Real-time detection of screenshot/recording attempts via Laravel events
- Programmatic screenshot capture (for bug reports, audit trails)
- Screen recording start/stop detection (iOS)
Installation
Requires a license from nativephp.com/plugins.
composer config repositories.nativephp-plugins composer https://plugins.nativephp.com
composer config http-basic.plugins.nativephp.com your@email.com your-license-key
composer require srwiez/nativephp-mobile-screenshots
php artisan vendor:publish --tag=nativephp-plugins-provider
php artisan native:plugin:register srwiez/nativephp-mobile-screenshots
PHP Usage
use Srwiez\NativephpMobileScreenshots\Facades\Screenshots;
// Block all screenshot/recording attempts
Screenshots::prevent();
// Allow screenshots again
Screenshots::allow();
// Programmatically capture the screen
Screenshots::capture();
// Check current prevention state
$isBlocked = Screenshots::isPreventing();
Livewire Usage
use Native\Mobile\Attributes\OnNative;
use Srwiez\NativephpMobileScreenshots\Events\ScreenshotDetected;
#[OnNative(ScreenshotDetected::class)]
public function onScreenshotDetected(): void
{
// Log the attempt, warn the user, etc.
$this->dispatch('screenshot-detected');
}
Compatibility
| Platform | Minimum Version |
|---|---|
| NativePHP | ^3.0 |
| iOS | 17.0+ |
| Android | API 26+ |
Events
ScreenshotDetected— user captured the screenScreenshotCaptured— programmatic capture succeededScreenshotCaptureFailed— programmatic capture failedScreenRecordingStarted(iOS only) — screen recording beganScreenRecordingStopped(iOS only) — screen recording ended